Root permission not granted to Android app for exceuting "su" command

12.7k Views Asked by At

I want to execute the "su" comand from an app..I have rooted the emulator and installed Superuser.apk(superuser 2.3.6.1)

Process pr= Runtime.getRuntime().exec("su");
process.waitFor();
Log.d("Ex.Value",Integer.toString(process.exitValue()));

But I'm getting 255 as the exit value which seems to be some error in executing "su". I have included RootTools library (http://code.google.com/p/roottools/). When checked with the methods RootTools.isRootAvailable(), RootTools.isAccessGiven()...Its found that the emulator has SU, but my application is not granted Root permissions. Will it be the real issue?? ..If so Can you plz tell how to grant my app the Root permission?

1

There are 1 best solutions below

3
On

When you execute 'su', you should have root access within that process. The app should then automatically ask for root permission to the user via a dialog box. This dialog box is provided by android but is only present in devices that have been rooted.

This blog post has an example that might help you:

http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/

The comments at the end are very informative as well.