Android Notification is disappeared when app is removed or updated

581 views Asked by At

When I develop an app, I found that notification is disappeared when app is removed or updated. There was no source code to unregister notification on my app.

I guess that when app is removed or updated, ACTION_PACKAGE_REMOVED intent will be broadcasted. And something call cancel() method on NotificationManager after receive it.

Is there anyone who know this mechanism or logic?

2

There are 2 answers

2
kodlan On

The package which is being removed will not receive this intent. See documentation here: https://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED

It seems like there is no way to track your app being removed.

0
Android On

Android will delete your notification upon upgrading. It is up to the app to store them and possibly restore them upon upgrading.