【问题标题】:Show status bar notification ticker text when screen is locked in Android当屏幕在 Android 中锁定时显示状态栏通知代码文本
【发布时间】:2013-08-02 19:32:16
【问题描述】:

我有一个显示在状态栏中的通知。如果用户在主屏幕上,则会显示与通知一起出现的代码文本。如果用户在锁定屏幕上,则会显示通知图标,但不会显示代码文本。即使用户在锁定屏幕上,如何让代码文本显示?

编辑:锁定屏幕代码文本在模拟器(2.3.3、4.0.3 和 4.1.2)中正常工作,但在我拥有的 2 台测试设备上不起作用(运行 4.0.4 的 Galaxy S3 和运行 Honeycomb 的 Galaxy Tab)。

EDIT 2:奇怪的是我已经在 S3 上测试了文本消息,并且成功显示了股票文本。然而,这可能是因为它是一个原生消息应用程序,而三星已通过第三方应用程序禁用了此功能?

NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
                .setSmallIcon(R.drawable.launch_icon)
                .setTicker("My ticker text")
                .setContentTitle(title)
                .setContentText(message)
                .setContentIntent(contentIntent);

【问题讨论】:

    标签: android notifications android-notifications lockscreen


    【解决方案1】:

    迟到的回答/评论,但在我的设备(运行 4.4 的 Galaxy s2)的锁定屏幕中显示代码。 使用 NotificationCompat.Builder

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-30
      • 1970-01-01
      • 2020-06-17
      • 1970-01-01
      • 2021-03-26
      • 1970-01-01
      相关资源
      最近更新 更多