androiddeep-linkingwhatsappintentfilterandroid-intent-chooser

Intent filter not working for "geo:" scheme in Android


I have noticed that when someone shares a location in WhatsApp using WhatsApp location share feature, tapping on the location opens up application chooser which included both GMAP and UberExample. Initially, it looked like it was something like the "ACTION_VIEW" intent with a "geo:" scheme. I am trying to make my Android app handle the "ACTION_VIEW" intent with a "geo:" scheme, but tapping on the location in WhatsApp is not working as expected. Here is my code in the AndroidManifest.xml file:

<activity
    android:name=".MapActivity">
    <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="geo"
            android:host="*"/>
    </intent-filter>
</activity>

When I tap on a location shared from WhatsApp, the Android system is not showing my app as an option in the app chooser. I have checked that my app is installed and that the activity is declared in the manifest file.

What could be the reason for the intent filter not working as expected, and how can I fix it? Does WhatsApp use any other type of DeepLink for this? When hovering or clicking the location from a PC, it redirects to https://maps.google.com/maps?q=23.7797847%2C90.4065005&z=17&hl=en


Solution

  • I was using similar intent filters. The main difference is that host is not specified. As I remember * in host should be used to match subdomains.

        <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="geo"/>
        </intent-filter>