If I use the mipmap
icon as smallIcon
of a Notification
in Android O
, when notify it, the system ui will crash. But it works below O, and if I change the icon with res in drawable
directory, it works as well. Although Google tell us we should place our app icons in mipmap
dirs, why I can not use it as the notification
icon in Android O?
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(notification.getTitle())
.setContentText(notification.getBody())
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_ALL)
.setContentIntent(pendingIntent);