Reputation: 1152
My notification doesn't show up the text on the status bar, but the sound and other options work perfectly. I'm on Android L, is this some kind of bug?
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
Uri ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(LocalService.this)
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(largeIcon)
.setTicker("Ticker Text")
.setContentTitle(notificationTitle)
.setContentText(notificationContent)
.setSound(ringtoneUri)
.setAutoCancel(true);
Intent resultIntent = new Intent(LocalService.this, ResultActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(LocalService.this);
stackBuilder.addParentStack(ResultActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(mId, mBuilder.build());
Upvotes: 1
Views: 5574
Reputation: 6682
It seems not a bug, according to Google API document about Notification
Text that summarizes this notification for accessibility services. As of the L release, this text is no longer shown on screen, but it is still useful to accessibility services (where it serves as an audible announcement of the notification's appearance).
So after Android L, we cannot get tickerText show on the screen. For more information you can check Android Police article.
Upvotes: 0