2

now i am working in android studio 2.2.2 tool.In my app if no internet connection then i should open mobile network setting page.

I am using this code

 Intent intent=new Intent(Settings.ACTION_SETTINGS);
 ComponentName cName = new ComponentName("com.android.phone","com.android.phone.Settings");
 intent.setComponent(cName);

once i click setting in popup its moving to mobile network more setting page not moving to setting page.It should move to setting page.

Thanks in advance.

Akash Patel
  • 2,757
  • 1
  • 22
  • 30
Sathish
  • 73
  • 1
  • 6

1 Answers1

1

Use this to launch mobile data settings

startActivityForResult(new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS), MOBILE_DATA_REQUEST_CODE);

Use this to launch mobile data settings

startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), WIFI_REQUEST_CODE);

Use

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);}
Lenzman
  • 1,177
  • 18
  • 30