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
  • 1,929
  • 2
  • 20
  • 31

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,051
  • 1
  • 17
  • 32