androidflutterandroid-intentfluttermap

Flutter app is not in the list to open shared location


I have a flutter app which includes a Map view.

If a user receives a location, I now want to open this location in my app. But somehow the app does not appear in the list of the location apps.

I am using the package https://pub.dev/packages/receive_intent to receive the intents.

I tried the following intent filters in AndroidManifest.xml:

         <!-- get geo-location from online mapservices (google, yandex, here, openstreetmap)  -->
        <intent-filter>
            <data android:scheme="http" />
            <data android:scheme="https" />
            <data android:scheme="geo" />
            <data android:host="maps.google.com" />
            <data android:host="maps.google.de" />
            <data android:host="www.openstreetmap.org" />
            <data android:host="openstreetmap.org" />
            <data android:host="maps.yandex.ru" />
            <data android:host="maps.yandex.com" />
            <data android:host="here.com" />
            <data android:host="www.here.com" />
            <data android:host="share.here.com" />
            <data android:host="goto.here.com" />
            <data android:host="go.here.com" />
            <data android:host="wego.here.com" />

            <action android:name="android.intent.action.VIEW" />

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

But I had no luck so far. Any help is appreciated.

Thank you in advance.


Solution

  • All you need is to add this in your androidManifest.xml (I added it in the flutter_sharing_intent androidManifest.xml, I think it could be both but I am not sure)

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

    And use the https://pub.dev/packages/flutter_sharing_intent package.

    Example function and its result:

    static void getShareFilesFromMoovitCallBack(List<SharedFile> sharedFiles) {
    if (sharedFiles.length != 1) return;
    print('Got shared files: ${sharedFiles[0].value}');}
    

    Result:

    Got shared files: geo:32.1472718,34.7929534?q=32.1472718,34.7929534