Android API 30 (Android 11)需要在应用程序清单中定义的额外权限才能打开其他应用程序(在我的例子中是Google Maps )。但是,如果<manifest>元素在Ionic/Cordova项目中不可用,我如何在我的项目中获得此权限?我有一个config.xml文件,列出了Android和iOS的权限,但我不知道在哪里添加这个权限。
Others曾表示,此接口更改需要在<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 Maps。它可以在Android API 29上运行,但不能在API 30上运行。
如何添加在Android中打开Google地图的权限?
发布于 2021-11-22 20:04:08
window.open(URL)将在安卓11上工作,无需权限更改或应用编程接口密钥即可打开谷歌地图。See help article.
本文解释了如何构建URL来以跨平台的方式打开谷歌地图,并支持查找位置和导航。我不需要处理权限、AndroidManifest.xml或Cordova元素。
在挖掘过程中,我使用了Ionic suggested Launch Navigator插件,它打开谷歌地图的方式略有不同,而且由于android11权限的改变,这个插件现在需要一个意图权限,这是我无法理解的,于是放弃了通过url启动的格式。
https://stackoverflow.com/questions/69980549
复制相似问题