Friday, September 12, 2014

Foreground notification launches "App Info" screen

Recently I found one issue with Notifications that can be simply formulated as "Don't forget to use setSmallIcon while building a notification".

Otherwise, you won't get any notification if you launch it from NotificationManager. That's bad and not obvious at all, but still easily noticeable.

But if you show your notification (without called setSmallIcon) via Service.startForeground() , you'll get notification with not working PendingIntent - on click you'll see your "App Info" settings screen. setSmallIcon fixed the problem immediately. This behavior is completely not understandable for me, but I happy I fixed it.

I spent several hours to isolate the issue (just by many attempts to show notification different ways), so I hope it helps someone.

No comments:

Post a Comment