ShoutSocial / share_handler

A plugin to facilitate receiving and handling share intents
43 stars 46 forks source link

Does not work with csv #61

Closed ebitogu closed 3 weeks ago

ebitogu commented 1 year ago

I can't get CSV to work. The path is always null

Here is my code

  Future<void> _initShareIntentHandler() async {
    final handler = ShareHandler.instance;
    handler.sharedMediaStream.listen((SharedMedia media) {
      if (!mounted) return;
      print("A CSV was received as ${media.attachments.first.path}"); //Always null
    });
    if (!mounted) return;
  }

Here is my AndroidManifest.xml setup

 <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/*" />
  </intent-filter>
Mounix99 commented 1 year ago

@ebitogu Hi! Use

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

For supporting any type of files. You should have both of this filters if you want to have ability share both text and files

JoshJuncker commented 3 weeks ago

Closing as the above comment is the answer.