android intent to open data-roaming setting page ,does not work correctly.

1.5k views Asked by At

I use the below code to open data-roaming setting page

f(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);
            startActivityForResult(intent,10);
        }
        else
        {
            Intent intent = new Intent();
            intent.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
            startActivityForResult(intent,10);
        }   

and it works fine on the most of the device.but on some devices it opens the settings page but data roaming option is not available in that page.

1

There are 1 answers

4
SMR On

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 using android 4.1.2