Ale*_*lex 6 settings android android-intent
我的应用应该打开移动网络设置活动.一切正常,但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);
Run Code Online (Sandbox Code Playgroud)
崩溃后的堆栈跟踪:
java.lang.SecurityException: Permission Denial: starting Intent { act=android.settings.DATA_ROAMING_SETTINGS cmp=com.android.phone/.Settings } from ProcessRecord{41b83198 ...
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?可能是因为清单?
更新:
似乎问题在这里解决了: Android - 移动网络设置菜单(Jelly Bean)
问题是将"com.android.phone.Settings"更改为"com.android.phone.MobileNetworkSettings"
我想你必须尝试
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
这个东西在android 4.1.2中对我有用,可能是他们在4.1.2中解决了这个问题
| 归档时间: |
|
| 查看次数: |
4954 次 |
| 最近记录: |