How to turn off Radio Signal via adb without airplane mode?


Question

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)


Answer


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?


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes