Reputation: 7973
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
Upvotes: 0
Views: 1789
Reputation: 1723
Start ADB shell:
adb shell
Set parameter airplane_mode_radios
to whatever you want airplane mode to switch off. Possible values include cell,bluetooth,wifi,nfc,wimax
. For your needs exclude bluethooth:
settings put global airplane_mode_radios cell,wifi,nfc,wimax
To remove this setting and return defaults to airplane mode run:
delete global airplane_mode_radios
There's also airplane_mode_toggleable_radios
setting which controls radios to be enabled again after turning airplane mode off. See answer on SO.
Upvotes: 2