Determine if running on a rooted device

后端 未结 24 2539
無奈伤痛
無奈伤痛 2020-11-22 06:43

My app has a certain piece of functionality that will only work on a device where root is available. Rather than having this feature fail when it is used (and then show an a

24条回答
  •  温柔的废话
    2020-11-22 06:49

    Two additional ideas, if you want to check if a device is root capable from your app:

    1. Check for the existing of the 'su' binary: run "which su" from Runtime.getRuntime().exec()
    2. Look for the SuperUser.apk in /system/app/Superuser.apk location

提交回复
热议问题