I know that we can do the following:
adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
adb shell input keyevent 19 ; adb shell input keyevent 23
to turn on/off airplane mode on android device.
However, is there anyway to check if currently the device has airplane mode turned on through ADB ?
I'm asking this because the two lines of code above will toggle airplane mode without knowing whether it is turning it on or off. But I need a way to make sure that airplane mode is indeed on/off through ADB.
Please help me out!
Thanks in advance
Android smartphone or tabletAccess the Settings utility. On the Settings screen, tap the Network & Internet option. On the Network & Internet screen, tap the toggle switch to the right of the Airplane Mode option to turn it on or off.
Open your phone's Settings app. Tap Network & internet. Turn Airplane mode on or off. When Airplane mode is on, Wi-Fi, mobile networks, and Bluetooth are all turned off.
You can use the following commands after doing adb shell.
Turn on:adb shell settings put global airplane_mode_on 1
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
Turn off:adb shell settings put global airplane_mode_on 0
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
This will make airplane mode ON/OFF
adb shell settings get global airplane_mode_on
returns 0
for airplane_mode off and 1
for airplane_mode on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With