android - How to cancel alarm manager alarms when user removes the app from recent apps list? -
android - How to cancel alarm manager alarms when user removes the app from recent apps list? -
as per comment in this question : "standard android allows remove things list on android 3.0+, , doing not impact alarmmanager events".
i cancel alarms if user swipes app list of recent apps, there seems no way can handle swiping of app recent apps list alarm canceled. have alternative in app user cancel alarm executes code :
public static void cancelalarm() { if (alarmup()) { alarmmgr.cancel(pendingintent); } } public static boolean alarmup() { homecoming (pendingintent != null); }
but how cancel alarm when app removed forcibly ? not want cancel alarm when app closed (by pressing or home button).
two steps needed accomplish this:
detect app removal recents list. see what happens when swipe android app recent apps list?. that's best info found on subject.
cancel alarm. question assumes pendingintent
variable still holds intent constructed earlier. won't work in activity unloaded. instead, build intent that's "equal to" original intent ("their action, data, type, class, , categories same"), , cancel one.
android alarmmanager android-alarms repeatingalarm
Comments
Post a Comment