Android : which call back do we get when we click CLEAR DATA of any application ? Steps : settings > applications > my_app > clear data !
Asked
Active
Viewed 1,693 times
4
-
1What do you mean by callback? – Patrick Evans Jun 05 '13 at 10:47
-
if you are thinking to override clear data functionality in your app then its not possible. – MR. Kumar Jun 05 '13 at 10:50
-
Patrick- i meant to say : where can i write my code which I want to be executed whenever the user is clearing data. – S P Jun 05 '13 at 10:59
-
G.V- oh. thnx for the info. do u know any other way around? – S P Jun 05 '13 at 10:59
-
@GunjanKumar There is a kind of a way to override the Clear Data functionality. See here: http://stackoverflow.com/a/7424193/211292 – ThomasW Jul 22 '16 at 02:31
1 Answers
0
which call back do we get when we click “CLEAR DATA” of any application ?
You do not get any "call back" specifically for this event.
That being said, I have not tried "Clear Data" with the app's process running. I would hope that "Clear Data" would terminate the process, and ideally in a graceful fashion, calling onDestroy()
on your components.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
ok i will somehow try to put my code in on destroy but i m afraid that wont solve my purpose..... thnx CommonsWare – S P Jun 05 '13 at 11:06
-
@SP: I repeat: You do not get any "call back" specifically for this event. Hence, if your app is not running, you do not get any "call back" specifically for this event. Your app would treat this the same as it treats the first run after installation, as both conditions are identical (e.g., nothing in internal storage). – CommonsWare Jun 05 '13 at 11:11
-
yeahhhhh i do understand. i was just thinking over ur line about "calling onDestroy()" . thnx CommonsWare. u r a big help most of the times. \m/ – S P Jun 05 '13 at 11:22
-
1I just ran a test and I found that `onDestroy()` is **not** called on the running activities when "Clear Data" is used. – ThomasW Jul 22 '16 at 02:49