-3

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!!

SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46

2 Answers2

0

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.

Top4o
  • 547
  • 6
  • 19
-3

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 :)

  • I see you are a new contributor. Welcome! By stating `programmatically`, the question is asked from a developer's perspective. It is expected that you answer all the questions here from a developer's or programmer's point of view. – SafalFrom2050 Nov 05 '22 at 20:22