Mobile network settings in Android 4.1

My application should open the "Mobile Network Settings" action. Everything works fine, except for devices with Android 4.1 that crash after trying to open Settings

Intent intent = new Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
final ComponentName cName = new ComponentName("com.android.phone", "com.android.phone.Settings");
intent.setComponent(cName);
startActivity(intent);

Stack trace after crash:

java.lang.SecurityException: Permission Denial: starting Intent { act=android.settings.DATA_ROAMING_SETTINGS cmp=com.android.phone/.Settings } from ProcessRecord{41b83198 ...

Any ideas? Could this be due to a manifest?

UPDATE:

Looks like the problem was solved here: Android - Mobile Network Settings Menu (Jelly Bean)

The point is to change "com.android.phone.Settings" to "com.android.phone.MobileNetworkSettings"

+5
source share
1 answer

I think you need to try

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

This thing works for me in android 4.1.2, maybe they fixed this problem in 4.1.2

+7
source

All Articles