3

As I'm trying to make a script to restart radio signal and I'm not using usb cable for adb, I need to turn off my mobile signal WITHOUT using airplane (because I'm using Wifi Hotspot and Wifi ADB).

Is there a solution for that? I have root and wifi adb running smoothly... and I have seen some solution as disabling mobile data and so on but this is not enough for me. My carrier sometimes stop providing me mobile connection and the only way to get active mobile data is to restart the radio signal (just as I'd do if I type ##4636*#*# and press the "turn off/on radio" button).

Also if possible, after turning off radio signal, I'd need to wait +- 10 seconds before going on again (I suppose the command for that is sleep 10).

Thanks :D

PS: Android Lollipop 5.1.1 (Xperia Z1)

2

I need to turn off my mobile signal WITHOUT using airplane (because I'm using Wifi Hotspot and Wifi ADB).

You can configure your device to not stop Wi-Fi (Hotspot includes) when activating Airplane mode.

(Note: I tested the solution in Android 4.2.1, 4.4.2, 5.0.2 and 5.1.1.)

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 in PC, enable USB debugging in device, connect it into PC, launch a shell and enter either one of the command

adb shell settings get global airplane_mode_radios
adb shell content query --uri content://settings/global  --projection name:value --where "name='airplane_mode_radios'"

(See usage of settings and content command using adb shell settings and adb shell content)

Given the command you executed you would see something like (either one of the result):

cell,bluetooth,wifi,nfc,wimax
Row: 0 name=airplane_mode_radios, value=cell,bluetooth,wifi,nfc,wimax

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/Hotspot followed by the Airplane mode. Your Wi-Fi/Hotspot 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 add wifi in that key's value.

Answer originally written for Possible to turn on Airplane mode with WiFi on only?

  • 1
    Thanks! In addition to that, for Airplane On and Off function, I followed this How to turn off cellular radio in Lollipop/JellyBean using adb? only adding ADB SHEEL before each command. :D – Diego Nov 22 '15 at 19:03
  • Ah, that's what I'd needed a week ago. If you just update the fields in the database, it only gets activated after a reboot. I bet yours dosn't need that :) – Izzy Nov 22 '15 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.