2017-05-03 3 views

답변

0

코드에서이 속성을 확인한 다음 Google 주식 이미지와 비교해보십시오.

System.getProperty("os.version"); // OS version 
android.os.Build.VERSION.SDK  // API Level 
android.os.Build.DEVICE   // Device 
android.os.Build.MODEL   // Model 
android.os.Build.PRODUCT   // Product 

거의 모든 맞춤 ROM이 루팅되어 있으므로 기기가 루팅되었는지 여부도 확인할 수 있습니다. 아래는 루트를 검사하는 코드입니다.

public static boolean isRooted() { 

    // get from build info 
    String buildTags = android.os.Build.TAGS; 
    if (buildTags != null && buildTags.contains("test-keys")) { 
     return true; 
    } 

    // check if /system/app/Superuser.apk is present 
    try { 
     File file = new File("/system/app/Superuser.apk"); 
     if (file.exists()) { 
     return true; 
     } 
    } catch (Exception e1) { 
     // ignore 
    } 

    // try executing commands 
    return canExecuteCommand("/system/xbin/which su") 
     || canExecuteCommand("/system/bin/which su") || canExecuteCommand("which su"); 
    } 

    // executes a command on the system 
    private static boolean canExecuteCommand(String command) { 
    boolean executedSuccesfully; 
    try { 
     Runtime.getRuntime().exec(command); 
     executedSuccesfully = true; 
    } catch (Exception e) { 
     executedSuccesfully = false; 
    } 

    return executedSuccesfully; 
    } 

PS 에뮬레이터는 루팅 된 장치입니다. 실제 장치에서 테스트

+0

방법 Google 주식 이미지와 비교합니까? –

1
System.getProperty("os.version"); // OS version 
android.os.Build.VERSION.SDK  // API Level 
android.os.Build.DEVICE   // Device 
android.os.Build.MODEL   // Model 
android.os.Build.PRODUCT   // Product 

이 사용하고 장치가 뿌리 여부를 확인 할 수 있도록 다음, 구글 주식 images.One 가지 더에 뿌리를두고 모든 사용자 정의 ROM을 거의 99 %를 비교합니다. RootTools 라이브러리 루트를 확인하는 간단한 방법을 제공합니다

RootTools.isRootAvailable() 당신은 How to find out who the ROM provider is? 그리고 RootTools에 대한 는 아래 링크를 사용 자세한 내용은 링크 아래에 참조 할 수 있습니다

https://github.com/Stericson/RootTools

관련 문제