You Need to create a notification channel for API level above 26(oreo).
`NotificationChannel channel = new NotificationChannel(STRING_ID,CHANNEL_NAME,NotificationManager.IMPORTANCE_HIGH);
STRING_ID = string notification channelid is the same as in Notification.Builder like this
`Notification notification = new Notification.Builder(this,STRING_ID)
.setSmallIcon(android.R.drawable.ic_menu_help)
.setContentTitle("Hello Notification")
.setContentText("It is Working")
.setContentIntent(pendingIntent)
.build();`
Channel id in the notification and in the notification should be same Whole code is like this.. `
@RequiresApi(api = Build.VERSION_CODES.O)
private void callNotification2() {
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,11,
intent,PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new Notification.Builder(this,"22")
.setSmallIcon(android.R.drawable.ic_menu_help)
.setContentTitle("Hello Notification")
.setContentText("It is Working")
.setContentIntent(pendingIntent)
.build();
NotificationChannel channel = new
NotificationChannel("22","newName",NotificationManager.IMPORTANCE_HIGH);
NotificationManager manager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
manager.notify(11,notification);
}'