2

I want to develop an open source app for uninstalling applications. How can I do this?

And how can I uninstall an app that is in /system/app/ after I gain root access?

Thanks

Mustafa Chelik
  • 2,113
  • 2
  • 17
  • 29

2 Answers2

2

You can execute adb commands from within your app if you have root access like this

Process process = Runtime.getRuntime().exec("your command");
BufferedReader bufferedReader = new BufferedReader(
                                    new InputStreamReader(process.getInputStream()));

use try catch as well for this code

Pavneet_Singh
  • 36,884
  • 5
  • 53
  • 68
  • 1
    usually u can try uninstall if u don't want to search the path of app if the app is already installed `adb uninstall app_name` although i guess u want to delete `apk` file from either sys or priv-app directory then u can use following remove command in adb and try link for more details `adb rm [-f/-r/-d] path_of_file` [link](http://adbshell.com/commands/adb-shell-rm) – Pavneet_Singh Jul 17 '16 at 08:04
  • Is there anyway to get path of an app or I should search it from "/" ? – Mustafa Chelik Jul 17 '16 at 12:34
  • 1
    according to my experience usually all non-os apps like bluetooth, browser etc ( +user apps ) are kept inside `app` directory which is under `system` directory separated from other vital apps like dialer,location apps. – Pavneet_Singh Jul 17 '16 at 14:33
1

After a little searching on the android developer website I found this package installer which facilitates the installation and removal (amongst other things) of apps.

public class PackageInstaller
void uninstall (String packageName, 
            IntentSender statusReceiver)

Uninstall the given package, removing it completely from the device.

I hope this covers your requirements.