What function to call in android to detect user has swipe closed the app? In general I wanna know how do I perform a task on swipe close of an android app
Asked
Active
Viewed 528 times
1
-
Related and possibly duplicate? http://stackoverflow.com/questions/24759941/what-method-is-being-called-when-i-close-an-app – Mauker Feb 15 '16 at 19:22
-
From where should I called this isAppRunning() method to check if the app is swipe closed? – Ankit Agarwal Feb 16 '16 at 05:23
-
The safest way for you to solve this problem is to make your app "ready" to be filled as soon as the 'onPause()' is called. Since the other methods like `onStop()` are not guaranteed to be called. And like CommonsWare said, you can't detect the swipe and execute a task. – Mauker Feb 16 '16 at 15:29
1 Answers
0
If you have a service running, it may be called with onTaskRemoved()
, though I have never tried this.
Otherwise, nothing will be called on any of your classes.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
No I don't have any service running. But I wanna know how do I perform a task on swipe app close? Because onDestroy() doesn't gets called in all cases when I swipe close the app – Ankit Agarwal Feb 15 '16 at 18:52
-
@AnkitAgarwal: "But I wanna know how do I perform a task on swipe app close?" -- AFAIK, you can't. – CommonsWare Feb 15 '16 at 18:55