We have encountered a strange problem in our app that happens mainly when our app is updated on the user's device when a notification is "live" on his notifications list.
When the user clicks on the notification - we get an exception :
android.app.RemoteServiceException
Bad notification posted from package ... : Couldn't create icon: StatusBarIcon(pkg=.....=0 id=0x0 level=0 visible=true num=0 )
It seems that since the app was updated - the resourceId has changed and is no longer legal, thus the exception (more info here : How to fix: android.app.RemoteServiceException: Bad notification posted from package *: Couldn't create icon: StatusBarIcon)
Currently, as a temporary solution, we set up a broadcast receiver
that gets triggered after an update of the app and cancels any existing notifications.
However - a more elegant solution would be to have a resource like R.drawable.ic_launcher
always get the same numeric value (identifier) when compiling so it would stay the same even after upgrades.
Is there a way to do this?