Possible to turn on Airplane mode with WiFi on only?
Well yeah, possible in all of my devices running Android 4.2.1, 4.4.2, 5.0.2 and 5.1.1. This applies for portable hotspot too.
The radios that are supposed to be turned off when Airplane mode gets enabled are saved in the key airplane_mode_radios
under the table global
inside /data/data/com.android.settings/databases/settings.db
(Settings Storage app's database).
Set up adb in PC, enable USB debugging in device, connect it into PC, launch a shell, and enter:
adb shell settings get global airplane_mode_radios
adb shell content query --uri content://settings/global --projection name:value --where "name='airplane_mode_radios'"
Given the command executed, you would see (either one of the result) something like:
cell,bluetooth,wifi,nfc,wimax
Row: 0 name=airplane_mode_toggleable_radios, value=bluetooth,wifi,nfc
You can choose to remove wifi
from the value to achieve the final objective.
Enter any one of the commands:
adb shell settings put global airplane_mode_radios "cell,bluetooth,nfc,wimax"
adb shell content update --uri content://settings/global --bind value:s:'cell,bluetooth,nfc,wimax' --where "name='airplane_mode_radios'"
Note: Do not copy-paste. Note the string that you got in the first output. Then remove wifi,
from it and then pass the resultant between the double quotes ""
the way I've shown above.
Now you can turn on the Wi-Fi followed by the Airplane mode. Your Wi-Fi wouldn't turn off.
The need for using ADB was meant for once only. If you decide to stop Wi-Fi when Airplane mode becomes active then simply include wifi
in that key's value.
All good here!
Do you know?
The reason you're able to toggle Wi-Fi, Bluetooth and NFC manually even when Airplane mode is active is because they are mentioned in the value for key airplane_mode_toggleable_radios
.
Enter any one of the commands:
adb shell settings get global airplane_mode_toggleable_radios
adb shell content query --uri content://settings/global --projection name:value --where "name='airplane_mode_toggleable_radios'"
You would see (either one of them) something like:
bluetooth,wifi,nfc
Row: 0 name=airplane_mode_toggleable_radios, value=bluetooth,nfc
Remove a radio from that key's value such as wifi
and you wouldn't be able to toggle that radio (Wi-Fi here) again when Airplane mode is active, no matter what, unless of course you revert the changes in that key's value.