Notification on Samsung Note 9 not working

518 Views Asked by At

Android Oreo notification is working fine on emulator but not working on Samsung Note 9. Can anyone suggest me any solution? The notification manager code snippet as follows for Oreo:

NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "channel_id_com_app_android")
.setOngoing(false)
.setAutoCancel(true)
.setSmallIcon(R.drawable.notification_icon_2)
.setColor(getResources().getColor(R.color.accent_color))
.setLargeIcon(convertToBitmap(getApplication().getResources().getDrawable(R.mipmap.ic_launcher)))
.setContentTitle(EmojiUtil.decode(name))
.setContentText(EmojiUtil.decode(message))
.setTicker(EmojiUtil.decode(message))
.setStyle(notiStyle)
.setContentIntent(notificationIntent);
builder.setStyle(bigTextStyle);
builder.setPriority(Notification.PRIORITY_HIGH);
builder.build();

NotificationChannel notificationChannel = new NotificationChannel("channel_id_com_app_android", getString(R.string.app_name), NotificationManager.IMPORTANCE_HIGH);
notificationChannel.setLightColor(R.color.accent_color);
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

manager.createNotificationChannel(notificationChannel);
0

There are 0 best solutions below