android Pie中针对firebase推送通知未显示图像图标

时间:2019-05-27 07:19:47

标签: android metadata firebase-notifications

我已经实现了推送通知,并且在所有操作系统中都可以正常工作,除了Pie。在饼状图中,通知图像未显示。

我已经更新了默认的图标。 我已经更新了代码OnMessageRecived中的图标。

 <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@mipmap/ic_launcher_new"/>
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/white" />
    <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/channel_id"/>



   NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, channelId)
                .setSmallIcon(R.mipmap.ic_launcher_new)
                .setLargeIcon(bitmap)
                .setContentTitle(title)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(secondText).setBigContentTitle(title))
                .setContentText(secondText)
                .setChannelId(channelId)
                .setPriority(Notification.PRIORITY_HIGH);

        TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
        stackBuilder.addNextIntent(intent);
        PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
                0,
                PendingIntent.FLAG_UPDATE_CURRENT
        );
        mBuilder.setContentIntent(resultPendingIntent);

        notificationManager.notify(notificationId, mBuilder.build());

1 个答案:

答案 0 :(得分:0)

像这样实现您的MyClassTests

NotificationCompat.Builder