时间未显示在Android 9及更高版本上的通知中

我正在通过FCM控制台在我的应用中发送通知,并且在以下android 9设备中正常工作,在上述android 9设备中,通知中未显示时间。

下面是我的代码-

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();

将两个参数添加到通知压缩后仍然不起作用-

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

有解决方案吗?

aucmaktq 回答:时间未显示在Android 9及更高版本上的通知中

使用setStyle方法,

.setStyle(NotificationCompat.BigTextStyle)
本文链接:https://www.f2er.com/3111435.html

大家都在问