how to change preferred network type over adb android?
13,145
This is working for my devices:
adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update global SET value = 1 WHERE name = 'preferred_network_mode'"
adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "select value FROM secure WHERE name = 'preferred_network_mode'"
adb shell settings put global airplane_mode_on 1
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
sleep 5;
adb shell settings put global airplane_mode_on 0
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
Author by
Sidartha Carvalho
Updated on July 24, 2022Comments
-
Sidartha Carvalho almost 2 years
How can I change the preferred network type with ADB?
Example: set Use only GSM, use only WCDMA, use only LTE or automatic.
-
pooja almost 9 yearsInstead of adb reboot you can use airplane mode on/off.
-
Admin almost 9 years@pooja No, Airplane mode doesn't help in my all the three devices. Only hard/soft-reboot does.
-
pooja almost 9 years@Arch Its working for my rooted devices. Just check my answer
-
Admin almost 9 yearsCould you mention why
sleep 5
is needed? And which Android version are your using? -
Admin almost 9 yearsBeside is there a reason
sqlite3 ...
is used and notsettings put global preferred_network_mode 1
? Also, what does second command does? -
Admin almost 9 yearsNope! Not working on CM12 rooted. It changes the value in
.db
but the changes doesn't take place on the radio level. You can check it in "Phone Info" through*#*#4636#*#*
where the preferred_network_type remains the same. What's more, a reboot is kinda reverting things back. Would you mind for the explanation of the commands? -
pooja almost 9 years@Arch Its working for lollipop and kitkat. This commands is used to open ur device setting.db and changing preferred_network_mode field with new values.
-
pooja almost 9 yearsI did the both reboot and airplane mode .. I don't want to reboot device that's why AP mode used. Sleep used to make some delay. It is changing in device network options.
-
Admin almost 9 yearsLet us continue this discussion in chat.
-
Usman almost 9 yearsfor non-rooted device ??
-
Usman almost 9 yearsError: unable to open database "/data/data/com.android.providers.settings/databases/settings.db": unable to open database file
-
Kozuch over 7 yearsThis is not working on a rooted Samsung S5 (SM-G901F).
-
Kozuch over 7 yearsThis is not working on a rooted Samsung S5 (SM-G901F).
-
Grayson Henry over 7 years@Kozuch which OS are you using? Try stackoverflow.com/questions/37848059/… for the Marshmallow OS
-
Kozuch over 7 yearsIt is Android 5.0.2.
-
Prajwal almost 6 years@Arch why have you not used settings put global preferred_network_mode 1? Why it doesn't work ?(I tried and it's not working)