What you need to do is something like:
Process root = Runtime.getRuntime().exec("su");
That causes SuperUser to show, which lets you either Allow or Block it from root access. This approach might not work if the user is not rooted. Here is a way you can test it.
More Related Contents:
- bypass android usb host permission confirmation dialog
- adb remount permission denied, but able to access super user in shell — android
- How to get manifest permissions of any installed Android app
- Automatically accept all SDK licences
- Changing API level Android Studio
- Android INJECT_EVENTS permission
- How do I get the APK of an installed app without root access?
- How permission can be checked at runtime without throwing SecurityException?
- How to retrieve the android sdk version? [duplicate]
- Manifest Merger fails for appComponentFactory [duplicate]
- Android M Permissions : Confused on the usage of shouldShowRequestPermissionRationale() function
- Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED?
- How to use custom permissions in Android?
- Android SDK location
- Android “Screen Overlay Detected” message if user is trying to grant a permission when a notification is showing
- Trying to UNINSTALL_SHORTCUT but shortcut won’t go away
- Show toast widget underneath a view
- Android Marshmallow: Test permissions with Espresso?
- Android webview: download files like browsers do
- Android studio- “SDK tools directory is missing”
- Android BroadcastReceiver, auto run service after reboot of device
- “id cannot be resolved or is not a field” error?
- What are the Android SDK build-tools, platform-tools and tools? And which version should be used?
- Didn’t find class on path: DexPathList?
- Failure [INSTALL_FAILED_OLDER_SDK] Android Studio
- Launch a script as root through ADB
- Create System Application
- Android Studio SDK location
- adb shell su works but adb root does not
- SecurityException with grantUriPermission when sharing a file with FileProvider