我想从应用程序打开 Play 商店。在三星还好,在一加手机就失败了。 我不知道 alibaba 是从哪里来的。很奇怪。
异常 java.lang.SecurityException:权限被拒绝:启动 Intent { act=android.intent.action.VIEW dat= http://play.google.com/ ... cmp=com.alibaba.intl.android.apps.poseidon/com.alibaba.android.intl.weex.activity.WeexPageActivity } 来自 ProcessRecord{a1dd30c 15827:a2bliving.ie.a2b/u0a151} (pid=15827, uid=10151) 不是从 uid 10156 导出的
代码:
private static final String PLAY_STORE_LINK = "http://play.google.com/store/apps/details?id=%s&hl=en";
public void openUpdateLink() {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getExternalAppLink())));
}
public String getExternalAppLink() {
return String.format(PLAY_STORE_LINK, context.getPackageName());
}
最佳答案
您需要在 AndroidManifest.xml 文件中设置 android:exported="true"
<activity
android:name="com.anurag.example.MainActivity"
android:label="Demo"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" >
</action>
</intent-filter>
</activity>
关于java - 解决SecurityException : Permission Denial: starting Intent. 我需要什么权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41963980/