Reputation: 41
I wrote something to uninstall (delete) an App and have now the problem that the apk seems to be deleted but the app is not really deleted from phone..
The supposedly deleted app still exists in the launchers app drawer. And I can open the app, but it force closes the app.
I tested the procedure with an own App (existing at /data/app, not /system/app). With systemapps I didn't test.
Here the code:
private void delApp() {
String deleteCMD = "rm " + packageInfo.applicationInfo.sourceDir;
Process process;
try
{
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("mount -o remount,rw -t rfs /dev/stl5 /system; \n");
os.writeBytes(deleteCMD+"; \n");
os.writeBytes("mount -o remount,ro -t rfs /dev/stl5 /system; \n");
os.flush();
}
catch (IOException e)
{
e.printStackTrace();
}
}
Upvotes: 1
Views: 2604
Reputation: 3733
I don't rightly know why what you're doing does not work, maybe someone else can shed some light on that.
You could try:
pm uninstall com.package.name
instead of your rm /package/dir/path
method
I'm not sure if that works on apps in the /system/app directory
, however.
Also, take a look at: Application launcher icon is not deleted from Home screen when uninstalling android app
Upvotes: 3