我正在开发一个 Android 应用程序。我想从 root 设备保存我的应用程序。我成功地使用 Root 设备限制了我的应用程序,但是一台 Root 设备有 Magisk 应用程序,因此在这个 Magis 应用程序的帮助下,用户也可以在 Root 设备中打开我的应用程序。有人可以帮助我吗?提前致谢。
我的代码是
私有(private)静态 boolean 值 checkRootMethod1() { 字符串 buildTags = Build.TAGS; return buildTags != null && buildTags.contains("test-keys"); }
private static boolean checkRootMethod2() {
String[] paths = {"/system/apn/which sup/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su",
"/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su", "/system/bin/.ext/.su",
"/system/bin/failsafe/su", "/data/local/su", "/system/xbin/mu", "/su/bin/su", "/system/usr/we-need-root/su-backup"};
for (String path : paths) {
if (new File(path).exists()) return true;
}
return false;
}
private static boolean checkRootMethod3() {
File file = Environment.getDataDirectory();
return file != null && file.canWrite();
}
private static boolean checkRootMethod4() {
File file = new File("/system/bin/");
return file != null && file.canWrite();
}
private static boolean checkRootMethod5() {
return new File("/system/app/Superuser.apk").exists();
}
最佳答案
几天后,我得到了解决方案。 RootDevice是一个将检查所有类型的根设备检查的库。喜欢:
- 检查根管理应用程序
- 检查潜在危险的应用
- 检查RootCloakingApps
- 检查测试 key
- 检查危险属性
- checkForBusyBoxBinary
- checkForSuBinary
- 检查SuExists
- checkForRWSystem
关于java - 如何在包含 Magisk 应用程序的 root 设备中限制我的 Android 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58221251/