【发布时间】:2021-12-27 00:33:28
【问题描述】:
Android API 30 (Android 11) 需要在应用清单中定义的额外权限才能打开其他应用(在我的例子中是 Google 地图)。但是,如果 <manifest> 元素在 Ionic/Cordova 项目中不可用,我如何才能在我的项目中获得此权限?我有一个config.xml 文件,其中列出了 Android 和 iOS 的权限,但我不知道在哪里添加此权限。
Others 表示此 API 更改需要在 <manifest> 中添加权限
在我的 Ionic 5 项目中,我只能编辑如下所示的 config.xml 文件:
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" />
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>
</edit-config>
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
<allow-intent href="market:*" />
我已尝试添加建议的 <queries> 元素,但这不起作用。我单击 UI 中的地址并使用 Ionic Launch Navigator 插件打开 Google 地图。它适用于 Android API 29,但不适用于 API 30。
我应该如何添加在Android中打开谷歌地图的权限?
【问题讨论】:
标签: android cordova ionic-framework android-11