Hi I have read a lot about this argument, but don't get right solution how can change preferred network in android 5 pragmatically. just allow phone to used 3g only is it possible if yes then plz suggest me any code or any path!!
CodePudding user response:
I believe your requirements need a rooted phone. However if you wanna force network to be on LTE/GSM?CDMA then you can trigger that settings through an intent:
try{
Intent intent = new Intent("android.intent.action.MAIN");
intent.setClassName("com.android.settings", "com.android.settings.RadioInfo");
startActivity(intent);
} catch(Exception e){
Toast.makeText(getApplicationContext(), " Device not supported" , Toast.LENGTH_LONG).show();
}
Probably this can be also a good point to start from.
CodePudding user response:
Which phone are you using?
On my Samsung running android 12, I just go to Settings > Connections > Mobile Networks > Network mode, in the dropdown menu you choose what type of network you want to connect to (ie. lte/3g or 3g only or 2g only)
Hope this helps :)