0

I am sending a notification in my app from FCM console and working fine in below android 9 devices, In the above android 9 device Time is not displayed in the notification.

below is my code -

NotificationCompat.Builder mBuilder;
             mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0)
            .setAutoCancel(true)
            .setContentTitle(title)
            .setContentIntent(resultPendingIntent)
            .setSound(alarmSound)
            .setWhen(getTimeMilliSec(timeStamp))
            .setShowWhen(true)
            .setSmallIcon(smallicon)
            .setContentText(message)
            .setColor(colorPrimary)
            .setPriority(NotificationCompat.PRIORITY_HIGH)
            .setVibrate(new long[0])
            .build();

After adding two-parameter to notification compact still not working -

            .setWhen(getTimeMilliSec(timeStamp))
            .setShowWhen(true)

Any solution?

MurugananthamS
  • 2,233
  • 4
  • 16
  • 47
Ravi Bhandari
  • 4,319
  • 8
  • 36
  • 66

1 Answers1

0

use setStyle method,

.setStyle(NotificationCompat.BigTextStyle)