sandeep sandeep - 1 year ago 54
Android Question

How can I launch mobile network settings screen from my code

I want to launch mobile network settings screen, so that user can enable/disable 3g or data connection. Can anybody tell me which intent I need to use for starting activity.
I used

Intent in = new Intent(android.provider.Settings.ACTION_NETWORK_OPERATOR_SETTINGS )


Intent in = new Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS ).

but both of these didn't work.

Answer Source

They won't work because there was a bug that was fixed I think in 2.3.


You can bypass this using (for NETWORK_OPERATOR_SETTINGS)

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("", "");

Replace NetworkSetting with Settings for DATA_ROAMING_SETTINGS

there's another similar solution described in Error opening mobile network settings menu


I recently tested this and it seems that this workaround is still necessary up to API level 15. Since API level 16 the intents in the question seem to work correctly.