You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Intent选择器误显示Zoom应用及queryIntentActivities查询结果异常问题排查

Alright, let's tackle your two issues step by step—they're both tied to how Android handles intent matching and app visibility rules:

1. Why is Zoom showing up in the map intent chooser?

Zoom appears in the chooser because somewhere in its AndroidManifest.xml, there's an activity that declares an <intent-filter> capable of handling your ACTION_VIEW intent with a geo: scheme URI.

This filter might look something like this:

<activity
    android:name="com.zoom.some.activity.HandleLocation"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <!-- May or may not include DEFAULT category, but still matches -->
        <data android:scheme="geo" />
    </intent-filter>
</activity>

Zoom likely added this to support use cases like opening shared location links from meetings directly in their app. To confirm this, you can inspect Zoom's manifest using the aapt tool:

aapt dump xmltree com.zoom.us AndroidManifest.xml | grep -A 10 -B 2 "geo"

2. Why does queryIntentActivities return fewer results than the chooser?

This discrepancy is almost certainly caused by Android 11 (API 30+) package visibility restrictions:

  • Starting in API 30, Android limits which apps third-party apps can "see" by default. Your app can only query its own packages, pre-installed system apps (like Google Maps), and apps explicitly declared in your manifest's <queries> tag.
  • Since your app doesn't have the QUERY_ALL_PACKAGES permission or a <queries> entry for geo-handling intents, queryIntentActivities only returns the visible Google Maps activity.
  • Intent.createChooser is a system component, so it bypasses these visibility restrictions—it can list every app that actually handles the intent, including Zoom.

To fix this and make queryIntentActivities return all matching apps, you have two options:

Option 1: Add a <queries> tag (Recommended)

This is the most compliant approach. Add the following to your AndroidManifest.xml to explicitly allow your app to query apps that handle geo: URIs:

<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="geo" />
    </intent>
</queries>

Option 2: Request the QUERY_ALL_PACKAGES permission

Only use this if you truly need to query all apps (Google Play may require justification for this permission):

<uses-permission
    android:name="android.permission.QUERY_ALL_PACKAGES"
    tools:ignore="QueryAllPackagesPermission" />

One small side note: While not strictly required here, explicitly adding the DEFAULT category to your intent can ensure you match all standard activities that handle such intents:

val mapIntent = Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=53.9000,27.5667"))
mapIntent.addCategory(Intent.CATEGORY_DEFAULT)

内容的提问来源于stack exchange,提问作者Valery Kalesnikau

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 20:27:52