[英]How to send files to flutter app via sharing?
I want my flutter application to accept Videos and Images when shared by other apps.我希望我的 flutter 应用程序在由其他应用程序共享时接受视频和图像。 For eg.例如。 if a user hits the share button for an image from the Gallery, my app should show up in the list and when the user selects my application the app should be able to accept the file.如果用户点击图库中的图像的共享按钮,我的应用程序应该显示在列表中,并且当用户选择我的应用程序时,应用程序应该能够接受该文件。 This link explains how to accept text data but not files. 这个链接解释了如何接受文本数据而不是文件。
Here is the official documentation from Flutter team showing how to handle incoming intents from external applications. 这是来自 Flutter 团队的官方文档,展示了如何处理来自外部应用程序的传入意图。 Here , it is shown how to handle images and videos not only text. 在这里,它展示了如何处理图像和视频,而不仅仅是文本。
According to this article , the above-mentioned example has a problem. 根据这篇文章,上述示例存在问题。
However, I found that their piece of code only works, if you share data to an app that is still closed.但是,我发现他们的代码只有在您将数据共享到仍然关闭的应用程序时才有效。 If you had opened your app before and it idles in the background, it won't receive the sharing intent when it is resumed.如果您之前打开过您的应用程序并且它在后台闲置,它在恢复时将不会收到共享意图。 Therefore, I extended the example因此,我扩展了示例
So you might want to follow that tutorial as well.因此,您可能也想遵循该教程。
In addition, here is a flutter-share
plugin.另外,这里有一个flutter-share
插件。
Note, please, I have not tested them.请注意,我没有测试过它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.