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:sharedUserId
and android:sharedUserLabel
and 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:
Method clearApplicationUserData = getReflectedMethod("clearApplicationUserData", String.class, IPackageDataObserver.class);
And the method i use the get it reflected...
private Method getReflectedMethod(String methodname, Class<?>... args) {
Method temp = null;
try {
temp = pm.getClass().getMethod(methodname, args);
} catch (SecurityException e) {
return null;
} catch (NoSuchMethodException e) {
return null;
}
return temp;
}
The IPackageDataObserver
class should be copied from the original android source, and added as new class in the source folder of your project under the package android.content.pm
.
When you want to clear user data i think you should invoke the method like this:
public void clearApplicationUserData(String packageName) {
if (clearApplicationUserData != null) {
try {
clearApplicationUserData.invoke(pm, packageName, data_helper);
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
}
}
The data_helper is any class extending the IPackageDataObserver.Stub
class.
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