开发者

Understanding SU request

My app needs to request SU access (on rooted devices) and the only examples out there say to do this:

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

That's fine, but how do I associate that p process with w开发者_如何学编程hat I want to do next? For example how do I use that process to open a database so that the attempt to open the database happens with root permissions?


Please see this discussion: Run secure API calls as root, android

Basically, you'd have to specify the stuff you want to execute in your call to the exec() method. Since that's hard to do, using the system app is really the best way to do things.

For the actual call, do this in your code:

Process p = null; 
p = Runtime.getRuntime().exec("su sqlite3 your_query");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜