startForeground() does not show my Notification startForeground() does not show my Notification android android

startForeground() does not show my Notification


I just noticed that startForeground() doesn't show the notification icon if the id parameter is set to 0...

startForeground(0, notification); // Doesn't work...startForeground(1, notification); // Works!!!

I hope that it could help someone stuck on this.


in addition to the best answer. you should also check that have you called setSmallIcon.On my android phone, I cannot get what I expected without calling setSmallIcon


Is your service a started service or a bound service? I had the same issue with a bound service, but starting the service before binding it allowed me to call startForeground(int, notification) with and have the notification show up.