Android 4.0 4G toggle

前端 未结 4 1674
甜味超标
甜味超标 2021-02-06 14:20

This is for the Verizon LTE version of the Samsung Galaxy Nexus.

I am tasked with writing a tiny app that will effectively disable/enable 4G capability. This can be done

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 14:57

    I'm also interested in changing the settings WCDMA-only, WCDMA/LTE, ...

    I found the way to change Settings.secure.* with root privilege as is shown the below.

        new ExecuteAsRootBase() {
            @Override
            protected ArrayList getCommandsToExecute() {
                ArrayList cmds = new ArrayList();
                cmds.add("su -c 'chmod 755 "+mySqlite+"'");
                cmds.add("echo \"UPDATE secure SET value='"+ value +"' WHERE name='"+ key +"'; \" | "+mySqlite+" /data/data/com.android.providers.settings/databases/settings.db");
                //TODO: SQL injection can be done!!!
                return cmds;
            }
        }.execute();
    

    ExecuteAsRootBase is introduced here, and mySqlite is "/data/data/"+context.getPackageName()+"/files/sqlite3" where sqlite3 is put in advance.

    However, it seems that we have to call com.android.internal.telephony.Phone.setPreferredNetworkType() for switching (WCDMA only<=>WCDMA/LTE) after setting Settings.secure.PREFERRED_NETWORK_MODE. My phone (even set Settings.secure.PREFERRED_NETWORK_MODE = 2) attached to LTE network...

提交回复
热议问题