为什么我的Android通知的setTicker不起作用?

时间:2017-08-18 02:19:28

标签: android

我的代码如下:

NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
                Notification notification = new NotificationCompat.Builder(MainActivity.this)
                        .setContentTitle("nothing")
                        .setContentText("nothing").setWhen(System.currentTimeMillis())
                        .setSmallIcon(R.mipmap.ic_launcher)
                        .setTicker("help help help:)")
                        .setContentInfo("nothing")
                        .build();
                manager.notify(1, notification);

当我运行时,“帮助帮助:)”没有出现。

1 个答案:

答案 0 :(得分:1)

TickerText只会出现在Android 5.0(L)之前的手机上

从文档中摘录:

  

总结此无障碍服务通知的文本。如   在L版本中,此文本不再显示在屏幕上,但确实如此   对可访问性服务仍然有用(它可用作可听见的服务)   公告通知的出现。)

https://developer.android.com/reference/android/app/Notification.html#tickerText