android - How to detect app removed from the recent list -
i'm working on music app, , want stop service when user removes application recent list , not when first activity destroyed(because when user clicks back until app minimizes, in case first activity getting destroyed). please help. i want stop service when user removes application recent list. yes, can either using stopwithtask flag true service in manifest file. example: <service android:enabled="true" android:name=".myservice" android:exported="false" android:stopwithtask="true" /> or if need event of application being removed recent list, , before stopping service, can use this: <service android:enabled="true" android:name=".myservice" android:exported="false" android:stopwithtask="false" /> so service's method ontaskremoved called. ( remember , won't called if set stopwithtask true ). public class myservice ext...