Search code examples
javaandroidprocessandroid-serviceprocessbuilder

Using ProcessBuilder to start a service into my Android app but it only starts with "su" (root)


I am using ProcessBuilder, into my Android app, to start a service but it starts only if I put su before the actual command.

This works just fine:

su -c am startservice -a com.companyname.app.HELLO --ef opt 6 --ef ert -9

This one doesn't work:

am startservice -a com.companyname.app.HELLO --ef opt 6 --ef ert -9

What am I doing wrong?


Solution

  • I am not doing anything wrong. am startservice will not work without root privileges.

    Thanks to @CommonsWare for his answer.