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?