本文介绍了我怎样才能开通手机网络设置画面从我的code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要启动移动网络设置界面,让用户可以启用/禁用3G或数据连接。谁能告诉我,我需要使用的启动活动而意图。我用

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.

推荐答案

他们将无法工作,因为那里是固定,我认为在2.3中的错误。

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

请参阅 https://review.source.android.com/#/c/ 22229 /

您可以使用(用于NETWORK_OPERATOR_SETTINGS)绕过这个

You can bypass this using (for NETWORK_OPERATOR_SETTINGS)

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.android.phone", "com.android.phone.NetworkSetting");
startActivity(intent);

替换 NetworkSetting 设置的DATA_ROAMING_SETTINGS

Replace NetworkSetting with Settings for DATA_ROAMING_SETTINGS

有一个在Error打开移动网络设置菜单

更新

我最近测试了这一点,似乎这个解决方法还是有必要达到API级别15。由于API级16中的问题的意图似乎正常工作。

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.

这篇关于我怎样才能开通手机网络设置画面从我的code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 05:28