2016-11-26 2 views
1

Ich versuche, die Benachrichtigung zu erweitern, wenn der Text unter dem Code lang ist.NotificationCompat.Builder mit Erweitern Benachrichtigung funktioniert nicht

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) 
       .setSmallIcon(getNotificationIcon()) 
       .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary)) 
       .setContentTitle(getString(R.string.app_name)) 
       .setAutoCancel(true) 
       .setSound(defaultSoundUri) 
       .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody)) 
       .setContentIntent(pendingIntent); 

NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 

notificationManager.notify(0, notificationBuilder.build()); 

aber es zeigt Einzelzeilenbenachrichtigung und kann es nicht erweitern. Mein Testgerät ist der Marshmallow.

+0

Hilfe-, was ich Ihre Frage verstehen Sie großen Stil notifcation standardmäßig angezeigt werden soll bitte einen Blick auf die folgende URL haben http://stackoverflow.com/questions/23331682/ is-possible-set-expanded-notification-as-default-im-big-text-notifications – Sam

+0

@Sam Ich habe diesen Link nicht für mich funktioniert. –

Antwort

0

setpriority verwenden könnte

.setPriority(Notification.PRIORITY_MAX) 
Verwandte Themen