I am trying to create a notification after 6 seconds a button is pressed but the app doesn't show any notifications at all. Can anyone please have a look and try to figure out what I am doing wrong.
@Override
public void run() {
int id = 1;
Intent notificationIntent = new Intent(ConfirmOrderActivity.this,MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(ConfirmOrderActivity.this,id, notificationIntent,0);
NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(ConfirmOrderActivity.this, DEFAULT_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_restaurant_menu_black)
.setContentTitle("You Have a notification!")
.setContentText("See Your Notification")
.setContentIntent(pIntent);
Notification notification = nBuilder.build();
NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
manager.notify(id, notification);
}
}, 6000);