【问题标题】:Mobile Network Settings in Android 4.1Android 4.1 中的移动网络设置
【发布时间】:2012-08-22 05:57:16
【问题描述】:

我的应用应该打开移动网络设置活动。一切正常,除了 Android 4.1 的设备在尝试打开设置后崩溃

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);

崩溃后的堆栈跟踪:

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

有什么想法吗?会不会是清单的原因?

更新:

看来问题在这里解决了: Android - Mobile network settings menu (Jelly Bean)

问题是将“com.android.phone.Settings”更改为“com.android.phone.MobileNetworkSettings”

【问题讨论】:

标签: android android-intent settings


【解决方案1】:

我认为你必须尝试

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

这东西在 android 4.1.2 中对我有用, 可能他们在 4.1.2 中修复了这个问题

【讨论】:

    猜你喜欢
    • 2012-07-02
    • 2012-01-11
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-29
    • 1970-01-01
    相关资源
    最近更新 更多