0

When I use this way to jump to the APN settings page:

intent = new Intent(Settings.ACTION_APN_SETTINGS);
int subId = getDefaultDataSubId();
intent.putExtra("sub_id",subId );
startActivity(intent);

it like this: intent way

But it's normal when I enter through the system settings: system settings way

nan
  • 1
  • 1
  • try this in Intent constructor "android.settings.APN_SETTINGS" with flag intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); – NIKHIL MAURYA Dec 02 '19 at 11:04
  • thanks,but It doesn't work. – nan Dec 03 '19 at 01:06
  • I just tried this on two of our Dev-Phones here. On one it works, on the other I get the error "this setting is not available for the current user" - It worked on a Huawei P10 lite but it didn't work on a Nokia 6.1 --- So I guess, you are device-dependant here. – Grisgram Dec 03 '19 at 09:23
  • @Grisgram I guess so,thanks – nan Dec 03 '19 at 09:35

1 Answers1

1

Same problem on Pixel, solved like this:

startActivity(Intent(Settings.ACTION_APN_SETTINGS).apply {
                addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                putExtra(":settings:show_fragment_as_subsetting", true)
                putExtra("sub_id", SubscriptionManager.getDefaultDataSubscriptionId())
            })

https://cs.android.com/android/platform/superproject/+/android10-release:packages/apps/Settings/src/com/android/settings/network/telephony/ApnPreferenceController.java


But not working on Huawei. T_T

StarHH
  • 11
  • 2
  • Hi, it is recommended to not include links to external sources in the answers, it's better to add a code snippet in the answer instead. – KungWaz Dec 17 '19 at 15:38