Posted on

Change Android preferred network mode using AT commands

I needed a solution on how to change the preferred network mode on KitKat and Lollipop devices and, I had the “luck” of only having to target two rooted Samsung devices from the Galaxy Grand series.

My initial search lead me to a lot of stack overflow posts that mainly described solutions using code reflection of methods belonging to class. None of these seemed to work on more recent android versions, even if installing the app on the android folder reserved for system apps: /system/priv-app/.

One of the first clues on stack overflow was this post:

Nothing worked either: not the reflection code on the post, the app from TheMasterBaron/Toggle-2G, nothing!

A more useful clue came from this xda post:

The post talked among many things, of a way to execute AT commands from windows to android. I used PuTTY, made a serial COM4 connection to the device and in a few seconds, I was executing all sorts of AT commands and getting all sorts of responses. This was great but, I still had no clue on how to execute these commands on the android device itself.


I started to search about AT commands and one of the first things you learn is that they are different from device to device because different devices use different modems, etc.

A quick query of both devices using the command AT+CLAC showed a different list of supported commands and, event more surprising, in devices from the same company and series. The devices are more or less one year apart from each other in terms of release dates.


I found a lot of documents regarding AT commands but, this one has many practical examples on how to use them:

The first thing I had to know, was how to change the preferred network mode on both devices and, all the documentation found online was really helpful. Using PuTTY, I managed to change the network mode from 4G to GSM by using the following commands:



All the network modes were easy to find by using the query version of the above commands, after changing between different network modes:


One of the first things you got to search about, is what serial port does the modem uses: it’s on this serial port that all AT commands will be executed and all responses will be there also.

The initial search lead me to the ports ttyGS0 and smd0. The port smd0 seemed to work on KitKat and, by using this shell command I received my first OK response from android:

But, the happiness didn’t last long, I still had no clue on what port Lollipop was using so, I decided to use brute force, and executed ls /dev/ which returned a bunch of folders representing block/character devices. More info on this subject, here. I counted more or less 750 folders and, one of these folders, contained my serial port! All I had to do was find it! How? well, simple, just test them all in a simple way by trying to change the network mode, like this:


I did a search by blocks of 40 sequential commands from the 750 and almost at the end, eureka! The network mode changed! I found two serial ports that responded to the AT commands! These were the ones that did it:

The final version of the commands on both android versions, which changed the network mode from the default 4G to GSM:



So, that’s it, I hope this helps someone.





Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

2 thoughts on “Change Android preferred network mode using AT commands

  1. Hi, Can you please suggest same commands for Marshmello

    1. The commands maybe different not because of the android version but because of the device’s hardware. I suggest you try to find the port your device is using to accept AT commands.

Leave a Reply

Your email address will not be published. Required fields are marked *