Reputation: 1
adb shell settings put global airplane_mode_on 1
adb shell su -c am broadcast -a android.intent.action.AIRPLANE_MODE
It works if done through the adb program. But if you try to execute in your program, nothing happens. Root are present on the phone, also when the function is executed, a toast pops up stating that superuser rights have been granted.
Runtime.getRuntime().exec("su -c 'settings put global airplane_mode_on 1'");
Runtime.getRuntime().exec("su -c 'am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true'");
what am I doing wrong?
Upvotes: 0
Views: 1641
Reputation: 124
To enable/disable the Airplane mode,use the following adb commands:
adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
#toggle/opposite
adb shell input keyevent 19 & adb shell input keyevent 19 & adb shell input keyevent 23
Upvotes: 0