I am trying to start the startForegroundService()
in android O
and above devices.
And the service got started. In the onCreate()
method of the service, I have added the startForeground()
with notification.
But the notification is not coming. I cant able to see it.
My code in the onCreate()
method of the service:
Notification.Builder builder = new Notification.Builder(this, "1")
.setContentTitle(getString(R.string.app_name))
.setContentText("in app filling")
.setAutoCancel(true);
Notification notification = builder.build();
startForeground(1, notification);