我的应用应该打开移动网络设置活动.一切正常,但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"
自API 23开始不推荐使用KeyPairGeneratorSpec。如何处理此警告?
示例代码:
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore");
kpg.initialize(new KeyPairGeneratorSpec.Builder(context).build());
Run Code Online (Sandbox Code Playgroud)