[Root Required] Change mobile network mode programmatically

[Root] Change Mobile Network Screenshot
[Root] Change Mobile Network Screenshot
Update
Mar 27, 2023
Developer
Category
Installs
50,000+
Rate
0
You do not really need to root your device, but this app must be placed in /system/priv-app/ or /system/app/ for old OSes. It can be easily achieved by using a third party recovery. You can also use root explorer or some other file managers to move this app into the required folder on a rooted device. Otherwise it won't work.
So for your convenience, the APK can be directly downloaded at https://github.com/Hzj-jie/android-mobile-network-mode/raw/master/android-mobile-network-mode-release.apk.

This app installs three items in app menu, "Enable 2G", "Enable 3G" and "Enable 4G". Each one does its job and quit. i.e. Enable 2G, 3G or 4G. Please refer to the first screenshot.

I am using this with https://play.google.com/store/apps/details?id=org.gemini.init, and change network preference according to the location. Ex.
https://github.com/Hzj-jie/android-init/blob/master/sample/auto-network.sh

You can also manually set the the preferred network type by using an intent,
mobile-network-mode://org.gemini.mobile-network-mode/#{TYPE}
The type can be found in https://android.googlesource.com/platform/frameworks/base/+/master/telephony/java/com/android/internal/telephony/RILConstants.java#136.