Saturday, 1 December 2018

Sending an Intent from Google Maps to an Android app with geo information

I'd like to send Intent from Google Maps to the Android app I'm developing, that would include geo information (latitude, longitude, etc).

I know it requires setting up an intent filter, however the only one I got working so far is the plain/text one:

<intent-filter>
    <action android:name="android.intent.action.SEND"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="text/plain"/>
</intent-filter>

This however only gives me textual description looking like this:

899 Green St, San Francisco, CA 94133, https://goo.gl/maps/R4A82MNvUpA2

I've experimented with the below, however that didn't work (the intent wasn't even registered in Google Maps):

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

Does anyone know how to do this? I'm using Android 9 (Pie).



from Sending an Intent from Google Maps to an Android app with geo information

No comments:

Post a Comment