I am trying to enable/disable Airplane mode via ADB commands.
I have found the following adb commands for enable or disable Airplane mode.
adb shell settings put global airplane_mode_on 1
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE
adb shell settings put global airplane_mode_on 0
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE
But, wifi and bluetooth connection will be lost. How can I execute aadb for flight mode with out lose wifi and bluetooth
Start ADB shell:
Set parameter
airplane_mode_radiosto whatever you want airplane mode to switch off. Possible values includecell,bluetooth,wifi,nfc,wimax. For your needs exclude bluethooth:To remove this setting and return defaults to airplane mode run:
There's also
airplane_mode_toggleable_radiossetting which controls radios to be enabled again after turning airplane mode off. See answer on SO.