Just exec the command su
and within that Process
you have root priviliges:
Process p = Runtime.getRuntime().exec("su");
See this blog post for full example.
More Related Contents:
- Determine if running on a rooted device
- How do I get the APK of an installed app without root access?
- ADB root is not working on emulator (cannot run as root in production builds)
- How can I get root permissions through the Android SDK?
- READ_LOGS permission on Jelly Bean (api 16)
- bypass android usb host permission confirmation dialog
- Permanently hide Android Status Bar
- adb remount permission denied, but able to access super user in shell — android
- Read command output inside su process
- Launch a script as root through ADB
- Bypass android usb host permission confirmation dialog on Android 9
- Create System Application
- adb shell su works but adb root does not
- How to display HTML in TextView?
- How to change spinner text size and text color?
- How to make a countdown timer in Android?
- Calling activity class method from Service class
- Simple parse JSON from URL on Android and display in listview
- Design Android EditText to show error message as described by google
- LocationSettingsRequest dialog to enable GPS – onActivityResult() skipped
- Failed to allocate memory: 8
- Fade In Fade Out Android Animation in Java
- PreferenceFragmentCompat requires preferenceTheme to be set
- Android NDK: getting the backtrace
- Screen overlay detected blocks Android permissions
- Firebase ServerValue.TIMESTAMP in Java data models objects
- refresh fragment UI from fragmentActivity
- Android Google+ integration – repeated UserRecoverableAuthException
- FloatingActionButton hide on list scroll
- Emulator not running