I am working on a project where, being at a specific event, we show a local sticky notification. It should also be when the application is minimized. What I have to do is to delete the local notification whenever the application is killed (from Android due to lack of memory or from the user, removing from the list of recent applications).
Normally, onDestroy will be called whenever Android performs an operation to open some space. This is normal in one of the cases, however, when using the application from the latest application lists, onDestroy is not called and a sticky notification remains.
What I did was I performed an empty service that will force onDestroy when the application is killed (both swipe and system wipe) so that I can delete my notification.
However, what I would like to do is the difference between hitting and deleting the system.
Is it possible?
android android-activity android-lifecycle
Nikola
source share