本文介绍了如何检查是否android手机植根?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序编程找到,如果Android手机的根源。我发现像许多链接:
Effective方式编程检查,如果我扎根在Android?的关于同一主题的讨论。然而,如在这些链接中提到,没有一个,找出明确的方式。这些职位pretty老,我想知道是否有更好的东西现在要实现它在最近的版本?

I want to programatically find in my application if the android phone is rooted. I found many links like: Determine if running on a rooted deviceEffective way to programatically check if I'm rooted on Android? discussing on the same topic. However, as mentioned in those links there is no one and definite way to find out. These posts are pretty old and I was wondering if there is anything better to achieve it now in recent releases?

在此先感谢!

推荐答案

我从包裹的

private static boolean isRooted() {
    return findBinary("su");
}



public static boolean findBinary(String binaryName) {
    boolean found = false;
    if (!found) {
        String[] places = {"/sbin/", "/system/bin/", "/system/xbin/", "/data/local/xbin/",
                "/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/"};
        for (String where : places) {
            if ( new File( where + binaryName ).exists() ) {
                found = true;
                break;
            }
        }
    }
    return found;
}

这篇关于如何检查是否android手机植根?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 15:53