-1

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?

MG. Park
  • 11
  • 1

2 Answers2

0

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.

kodlan
  • 561
  • 8
  • 23
  • Hello, I already knew that. What I said is after the package is removed, which manager or service unregisters notifications registered on the package. – MG. Park Sep 19 '17 at 11:19
  • You can try using http://androidxref.com/ if you want to find some internal details. For example I've found this http://androidxref.com/source/xref/frameworks/base/core/java/com/android/internal/content/PackageMonitor.java#297 – kodlan Sep 19 '17 at 11:31
0

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

Android
  • 119
  • 9