RedPetals
RedPetals

Reputation: 81

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

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?

Upvotes: 5

Views: 5777

Answers (1)

Alex P.
Alex P.

Reputation: 31666

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';"

Upvotes: 4

Related Questions