the notification doesn't show in android 8 or higher, but its works fine in android 8 lower
This bellow what i tried
String code,code1,code2,title,message,image,urlImage;
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
kode = remoteMessage.getData().get("code");
kode1 = remoteMessage.getData().get("code1");
kode2 = remoteMessage.getData().get("code2");
title = remoteMessage.getData().get("title");
message = remoteMessage.getData().get("message");
image = remoteMessage.getData().get("image");
urlImage = remoteMessage.getData().get("image");
sendNotification_1(title,message, bitmap, code);
}
private void sendNotification_1(String title,String messageBody, Bitmap image, String kode){
Intent intent = new Intent(this, Home.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("directto", kode);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
if(image != null){
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setLargeIcon(convertToBitmap())/*Notification icon image*/
.setSmallIcon(R.drawable.logostar)
.setContentTitle(title)
.setContentText(messageBody)
.setStyle(new NotificationCompat.BigPictureStyle()
.bigPicture(image))
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* ID of notification */,
notificationBuilder.build());
}
}
Thats above my code , it still doesn't work in android 8 higher
bellow my edited code like you all suggested but still doesn't work