Issue
Basically my App displays the WebView of a website. and it logins (Google SignIn) correctly but after logout and pressing on LogIn Again doesn't take my account, instead it saves that Gmail once, and clicking log-in again uses previous login credentials. and it gets solved if I clear my app data using device settings. I am trying to reach and Clear my App Data Programmatically.
So far I have been able to delete app data using ( https://www.hrupin.com/2011/11/how-to-clear-user-data-in-your-android-application-programmatically )
But this link was useful if app data exist normally on DeviceFileExplorer data -> data -> package-name, and my problem is that app data is generated hidden inside internal storage (OS security).
Using these below commands I have been able to display them up on DeviceFileExplorer.
adb shell
run-as com.your.packagename
cp /data/data/com.your.packagename/
I have read that this command copies(not move) my hidden package data to this /data/data/com.your.packagename/
So deleting this /data/data/com.your.packagename/ won't help.
Solution
try this this might help but some oem have issues with this
private void clearData() {
try {
if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT) {
((ActivityManager)getSystemService(ACTIVITY_SERVICE)).clearApplicationUserData();
} else {
Runtime.getRuntime().exec("pm clear " + getApplicationContext().getPackageName());
}
} catch (Exception e) {
e.printStackTrace();
}
}
Answered By - Akash Pal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.