recieve_multi_sharing_intent

Forked from https://pub.dev/packages/receive_sharing_intent Refer to the original documentation for ios instructions, and android setup instructions

To support multiple different Intents with the same media type, you have to use ActivityAlias in your AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
.....
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

  <application
        android:name="io.flutter.app.FlutterApplication"
        ...
        >

    <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            ...
            ...
   </activity>
   <activity-alias
        android:name="<FQDN1>"
        android:targetActivity="<original activity name>"
        android:label="<app label>"
        android:icon="<app icon">
    >
        <intent-filter>
       	     <!--TODO: Add this filter, if you want to support sharing images into your app-->
             <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
            </intent-filter>
        </intent-filter>
    </activity-alias>
    <activity-alias
        android:name="<FQDN2>"
        android:targetActivity="<original activity name>"
        android:label="<app label>"
        android:icon="<app icon">
    >    
        <intent-filter>
             <!--TODO: Add this filter, if you want to support sharing images into your app-->
             <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
            </intent-filter>
        </intent-filter>
    </activity-alias>

Please note the android:name in the <activity-alias> it is used to define multiple different intents, it needs to be a Fully Qualified Domain Name

On the dart side

// For sharing images coming from outside the app while the app is in the memory
    _intentDataStreamSubscription =
        ReceiveSharingIntent.getMediaStream().listen((List<SharedMediaFile> value) {

this has been changed to

// For sharing images coming from outside the app while the app is in the memory
    _intentDataStreamSubscription =
        ReceiveSharingIntent.getMediaStream("<FQDN alias>").listen((List<SharedMediaFile> value) {

Similarly

ReceiveSharingIntent.getInitialMedia().then((List<SharedMediaFile> value) {
      setState(() {
        _sharedFiles = value;
      });
    });

has been modified to

ReceiveSharingIntent.getInitialMedia("<FQDN alias>").then((List<SharedMediaFile> value) {
      setState(() {
        _sharedFiles = value;
      });
    });

As this is only implemented on the Android side, you might need to wrap it in a Platform.isAndroid