Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning airplane mode on via ADB(Android 4.1 or earlier)

Tags:

android

adb

I found this question and I tried as follows :

settings put global airplane_mode_on 1
am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true

It works really well on Android 4.4.1

but does not work in 4.0.1. (settings: not found / It supports version 4.2 or higher.)

So, i tried again as follows :

adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
adb shell input keyevent 19
adb shell input keyevent 23
adb shell input keyevent 4

Also, this work is strange

"AIRPLANE_MODE_SETTINGS" Window Popup -> Focus on Airplane Mode (no check) -> Volume up........

And it is turned off the screen, does not work

So I think that this way is not good.

Q : How to work like a 'settings put global airplane_mode_on 1' in 4.1 or earlier?

like image 555
RedPetals Avatar asked Oct 20 '22 03:10

RedPetals


1 Answers

AIRPLANE_MODE_ON used to belong to system namespace before they moved it to global. So the old settings command would have been settings put system airplane_mode_on 1. But since the settings command is not available in your build you can just modify the value directly in the database instead:

sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update system set value='1' where name='airplane_mode_on';"
like image 72
Alex P. Avatar answered Oct 23 '22 01:10

Alex P.