How to execute adb commands from my App?

1

I want to execute a series of commands adb one of them is to obtain the path of the user's apps, but I do not know if it is possible to place adb commands in my app. If you know please help.

    
asked by PowerApp 20.10.2016 в 22:19
source

1 answer

2

This can be done in this way by:

   try {
        Process process = Runtime.getRuntime().exec("adb ....");
    } catch (IOException e) {
        e.printStackTrace();
    }

It intrigues me to know for what kind of application you would like to run the ADB from your application since You regularly run the ADB from the command line, this to perform some action on the device. Something important is that from the command line you can have more privileges than executing your process from the device.

Friend Jose, I've seen you ask this question:

How to Move a User App?

That's probably why you ask about the ADB , as I said earlier, if you run from the device you probably do not have the same privileges and move the application you probably could not do it.

Example move application to external memory:

adb shell pm install -i "com.myapp.elenasys" -s -r /data/app/com.myapp.elenasys.apk
    
answered by 20.10.2016 / 23:13
source