0

I'm an Android app developer. I want to kill the service running in the background, consuming resources. I tried

Runtime.getRuntime (). Exec ("sh" + packagename_to_stop)

But it did not work; Can someone help me? I appreciate your help.

Archlight
  • 2,019
  • 2
  • 21
  • 34

1 Answers1

0

you need to gain root access first,

How can I get root permissions through the Android SDK?

Process root = Runtime.getRuntime().exec("su");

your app will have root access, then you can execute your commands as Root user.

Community
  • 1
  • 1
Yazan
  • 6,074
  • 1
  • 19
  • 33