Differentiate between Android killing the app and user swiping it off on the recent apps list -
i working on project, while being on specific activity show local sticky notification. should case when app minimized. have accomplish remove local notification whenever app killed (by android, because of memory lack or user, swipe recent apps list).
usually ondestroy
called whenever android takes activity open space. fine in 1 of cases, swiping app recent app lists doesn't call ondestroy
, sticky notification stays.
what did is, implemented empty service force ondestroy
when app killed (both swipe , system kill) can notification removed.
however, differentiate between swipes , system kill.
is possible?
in general, if android wants kill application because has been in background long (or because wants reclaim resources), android kill os process hosting app. will not call finish()
or ondestroy()
on activity or service components. behaviour of "swipe recent tasks list" has changed on time , different in different android versions. should write book :-(
Comments
Post a Comment