Receive share file intents with Flutter

2020-08-23 04:34发布

问题:

I searched for a way to make my flutter app receive intents from other apps, but didn't find any.

I want to RECEIVE INTENTS not to send them.

example:

I want to open the Gallery and click on the share button, and choose my flutter app from the menu. and then have my flutter app receive the intent with the picture (and later send it by HTTP request).

Does anyone know how to do it?

回答1:

You can use flutter-share, all info in Github

You won't have to meddle with java except for changing the MainActivity extends.

It is fully functional for Android, and the iOS part is currently being developed to match the Android part.

Update (2020):

Now you can also use receive_sharing_intent package. More info in pub.dev



回答2:

There's a complete & simple example here - it includes everything you need both on the native side, and on the flutter side: https://flutter.io/flutter-for-android/#how-do-i-handle-incoming-intents-from-external-applications-in-flutter