Daniele
Daniele

Reputation: 678

Allow Super User permission programmatically

I want to use shell command for my app as root permission. I put in my manifest:

<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>

I want to know if there is a way to allow Super User permission programmatically without using any input device. As you know a window like this is appearing : enter image description here

I want to avoid that step and programmatically select Remember choice forever.

Upvotes: 1

Views: 5546

Answers (2)

Dr Mido
Dr Mido

Reputation: 2704

Just exec the command su and within that Process you have root priviliges:

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

See this blog post for full example.

Source

Upvotes: 1

Yogesh Rathi
Yogesh Rathi

Reputation: 6499

Short answer! You can not do programatically !

Upvotes: 1

Related Questions