简体   繁体   中英

Root permission not granted to Android app for exceuting “su” command

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM