Flutter 应用程序未出现在 Android 上位置/地图链接的“打开方式”选项中

问题描述 投票:0回答:1

我正在开发一个 Flutter 应用程序,我希望它能够处理位置或地图链接。具体来说,当用户单击 Android 设备上的地图或位置链接时,我希望我的应用程序出现在“打开方式”选项中,并且如果可能,获取地图/位置链接的纬度和经度。但是,我无法让我的应用程序显示在选项列表中。

我尝试在 AndroidManifest.xml 文件中添加意图过滤器,但我的应用程序仍然未被识别为打开这些链接的选项,是否还有我应该执行的其他步骤或不同的方法?

This is how I expect the app to appear

这是我的 AndroidManifest.xml 的相关部分:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
        android:scheme="https"
        android:host="www.google.com"
        android:pathPrefix="/maps" />
</intent-filter>
flutter dart google-maps maps
1个回答
0
投票

如果您想在应用程序中打开Google Maps链接,请按以下方式调整。

确保它位于活动标签意图过滤器内

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data android:scheme="http"
        android:host="maps.google.com"
        android:pathPrefix="/maps" />
</intent-filter>

通过此配置,您的应用程序将处理具有“http”方案、主机“maps.google.com”和以“/maps”开头的路径的URL。例如,它将匹配如下 URL:

http://maps.google.com/maps/place/...

http://maps.google.com/maps/directions/...

http://maps.google.com/maps?q=...

© www.soinside.com 2019 - 2024. All rights reserved.