开发者

How can you detect if the device is rooted in the app? [duplicate]

This question already has answers here: 开发者_Python百科 Closed 11 years ago.

Possible Duplicate:

Determine if running on a rooted device

On Launch of the application, I want to detect if the device running is rooted. Is there proper way of detecting it?

I don't think trying to write a file to '\data' to see if rooted is a good solution. (Since even rooted devices may have that path unprivileged)


At the end of the day, you can't. A rooted device may be modified in any way, and thus can completely hide whatever it wants from you. In practice you could look at some of the standard root builds to find features they have or characteristics you can look at... but there is no way to guarantee that whatever you do will actually detect a "rooted" device.


you could try to do

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

if that throws an exception or proc is null then they don't have root

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜