I want to erase the data of my app programatically. I've found the method clearApplicationUserData. But when I run it, the app minimizes itself. That is, the app goes to background, like when it is pressed the home button. This is my code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
((ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE))
.clearApplicationUserData();
} else {
// TODO
}
There is some way to erase data using this method without minimizing the app?
Method ActivityManager.clearApplicationUserData() will erase all your app's data, and kill the app process directly without any warnings. I check the documentation and the source, it seems not like a bug but designed to work like that. I have some speculations as below:
If you want to implemet your own method to manage your app's data. This answer maybe helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With