【发布时间】:2016-12-17 22:27:29
【问题描述】:
我正在为我的应用推送通知使用 Firebase 通知。 一切正常,但应用程序未运行时通知图标显示白色圆圈。 我的目标是 SDK 版本 23,我也在使用 Roman Nurik 的通知图标生成器来生成白色透明图标。
当应用程序处于前台并运行时,通知图标会正确显示。 img
但是当应用程序处于后台或被终止时,图标会被通用白色圆圈替换。 img
这是我的通知生成器方法:
private void sendNotification(String messageTitle, String messageBody) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notification = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_stat_notification_icon)
.setContentTitle(messageTitle)
.setContentText(messageBody)
.setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_DEFAULT)
.setDefaults(Notification.DEFAULT_ALL)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notification.build());
}
【问题讨论】:
标签: android android-layout firebase android-notifications firebase-notifications