adb command - Marshmallow - change preferred network mode LTE/GSM

拜拜、爱过 提交于 2019-12-06 12:03:09

问题


I am on the 6.0.1 Marshmallow OS and my previous commands to change the preferred network mode are no longer working.

Commands used in Kit Kat worked without issue:

adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT * FROM global WHERE name='preferred_network_mode'"
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'

Commands from above entered in this OS result in output:

Error: no such table: global

I pulled the database file, which was completely empty:

adb pull /data/data/com.android.providers.settings/databases/

Is there any ADB command that I can use to change the preferred_network_mode to LTE/GSM?


回答1:


After a lot of research, this was the working solution I found for Marshmallow.

The Preferred Network Mode numbers are found: https://android.googlesource.com/platform/hardware/ril/+/master/include/telephony/ril.h#228

1 is GSM Only

11 is LTE Only

adb wait-for-devices
adb root
adb wait-for-devices
adb shell settings list global | grep pref

This returned to me both "preferred_network_mode" and "preferred_network_mode1"

adb shell settings put global preferred_network_mode 1
adb shell settings put global preferred_network_mode1 1
adb shell stop ril-daemon
adb shell start ril-daemon



回答2:


For setting RAT on SUB1, run below command:

adb wait-for-devices

adb root

adb wait-for-devices

adb remount

adb shell settings put global preferred_network_mode 1

adb shell settings put global preferred_network_mode1 1

adb shell stop ril-daemon

adb shell start ril-daemon

adb shell settings put global airplane_mode_on 1

adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true

adb shell sleep 5;

adb shell settings put global airplane_mode_on 0

adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false

Now, check if RAT is set or not by running below command:

adb shell dumpsys telephony.registry | grep mServiceState




回答3:


adb shell:

content update --uri content://settings/global --bind value:i:12 --where "name='preferred_network_mode'"

12 == LTE + WCDMA, for more see ril.h

dont forget to set preferred_network_mode1 and preferred_network_mode2 and preferred_network_mode3



来源:https://stackoverflow.com/questions/37848059/adb-command-marshmallow-change-preferred-network-mode-lte-gsm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!