0

When I fire the system intent, the Android device opens the wrong settings page. I tried to open the Data Roaming setting page with the below code, but the device opened the settings page in which data roaming option is not present.

if (bv < Build.VERSION_CODES.JELLY_BEAN) {
    Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
    ComponentName cName = new ComponentName("com.android.phone", "com.android.phone.Settings");
    intent.setComponent(cName);
    startActivity(intent);
} else {
    Intent intent = new Intent();
    intent.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
    startActivity(intent);
}
Makoto
  • 104,088
  • 27
  • 192
  • 230
User10001
  • 1,295
  • 2
  • 18
  • 30
  • Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName("com.android.phone", "com.android.phone.NetworkSetting"); startActivity(intent); – Meenal Jan 31 '14 at 13:52
  • use this intent just change settings to networksetting – Meenal Jan 31 '14 at 13:54

1 Answers1

2

Try this

Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
startActivity(intent);

It's working in my case. This thing is working for me in android 4.1.2

M D
  • 47,665
  • 9
  • 93
  • 114
  • @ashish read more about older version support very nice SO post [here](http://stackoverflow.com/questions/4407818/error-opening-mobile-network-settings-menu) – M D Jan 31 '14 at 13:19
  • 1
    problem is that android system handles the intents but opens wrong activity. – User10001 Jan 31 '14 at 13:31