I want to change the preferred network mode ie. gsm or wcdma or auto, programmatically, from code, on Android.
Is this possible, and if so how ?
I want to change the preferred network mode ie. gsm or wcdma or auto, programmatically, from code, on Android.
Is this possible, and if so how ?
This is not an answer, but expanding on Tulio-F's answer.
The RILConstants.java contain the following:
Where:
** = "AVAILABLE Application Settings menu"
It is possible, I did it.
For this to work, your app must be signed with the system key or have carrier privilege. Otherwise the app will throw
java.lang.SecurityException: No modify permission or carrier privilege.
My app runs on Android 5.1 Lollipop(API 22) and is signed with the system key, so this is the only configuration I can confirm for sure that works. I can't confirm the carrier privilege approach.
AndroidManifest.xml
Add this permission to your app manifest. If you are using Android Studio, it will probably mark this line as an error because only system apps can have this permission. If you can sign your app with the system keys, don't worry.
Get Preferred Network
The return is defined in RILConstants.java, e.g.
RILConstants.NETWORK_MODE_WCDMA_PREF
Set Preferred Method.
The parameter must be based on
RILConstants.java
, e.g.:RILConstants.NETWORK_MODE_LTE_ONLY
This is an utility method to access the hidden API methods.
Answer is NO
We can open directly the settings app of mobile network settings to switch between "2G" and "allow 3G" networks.A direct switch is sadly not possible.
We can develop something which will show current network and allow user short-cut from the app where they can switch network.