Can we clear or delete data of one application from another application in android. If it is not possible simply could you please suggest any tricky way to do this like to go to the folder in internal memory and delete that folder programatically.
Thanks.
Simple answer,
Android is designed that this should not be possible.
But when using root access you can actually delete folders from other applications.
I believe if two applications having a different package, but with the same signature, actually can have access to each others private folders. Or i’m not sure, i believe you could add some kind of declaration to you manifest file allowing other (friend) apps to have access to your private folder. But i’m not sure i should search for it.
Edit after search:
Apps having the same
android:sharedUserIdandandroid:sharedUserLabeland signature have access to each others private files.http://developer.android.com/guide/topics/manifest/manifest-element.html#uid
Two Android applications with the same user ID
Edit 2:
There are some private methods in the android API, witch can be used to clear app data i think. I’m not sure but if you reflect those methods with the right permissions in you manifest file it could be possible to clear app data, but i’m not 100% sure.
Some small example code:
And the method i use the get it reflected…
The
IPackageDataObserverclass should be copied from the original android source, and added as new class in the source folder of your project under the packageandroid.content.pm.When you want to clear user data i think you should invoke the method like this:
The data_helper is any class extending the
IPackageDataObserver.Stubclass.You can find a lot of questions about reflecting methods and stuff here on stackoverflow.
I have no idea if this works but this is the only way i can think of.
Rolf