Android notification content text is not displayed on Kitkat OS 4.4.4, but shown on OS 5.0 Lollipop

I am implementing a notification for Android to parse push notifications in my application. But lately, I understand that the content of notifications is not shown on kitkat. it is displayed only on OS Lollipop.

here is the image ...
on Kitkat 4.4.4: on Lollipop 5.0: The code for both images is the same:
on kitkat 4.4.4


enter image description here


NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext);


Notification notification = mBuilder.setSmallIcon(smallIcon).setTicker(title) //title
        .setWhen(System.currentTimeMillis())
        .setAutoCancel(true)
        .setContentTitle(title)
        .setStyle(inboxStyle)
        .setContentIntent(resultPendingIntent)
        .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
        .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon))
        .setContentText(notifMessage)
        .build();

NotificationManager notificationManager = (NotificationManager) mContext
    .getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(mNotificationId, notification);

for information, I use build tools 23.0.2 (the latest when this question is written). here is my build.gradle application:

apply plugin: 'com.android.application'

android {
         compileSdkVersion 23
         buildToolsVersion "23.0.2"
...

what's the difference? Any help would be appreciated. thank you in advance

+4
source share
1

. :

.setWhen(System.currentTimeMillis())

:

.setWhen(0)

, . ,

+2

Source: https://habr.com/ru/post/1615550/


All Articles