My query is, i want to cancel services using alarm manager when application going to destroy/closed.
if i am in activity A by clicking on button started activity B suddenly user is going to press home button. ---- if application is running in background then don't cancel service. but when he going to remove from recent list of application at that time cancel service.
Service/Alarm manager will work even when user has sent application in background by pressing home screen.
No of way application can closed.
1) By clicking back button (multiple times if stack have multiple activities).
2) By pressing home button and then remove from recent list.
i am facing issue with (2)second option. in that when user press home button at that time service or alarm manager should be work. But when user will be going to remove application from recent list at that time i want to cancel service/alarm manager
.
Is there any Listners/Methods through which we can identify?