简体   繁体   English

如何通过共享将文件发送到 flutter 应用程序?

[英]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.

相关问题 如何通过我的应用程序通过 Intent 共享/发送视频数据到 Tik-Tok 应用程序,就像图库共享一样 - How to share/send Video Data to Tik-Tok app via Intent through my app, just like gallery sharing 通过ACTION_SEND进行共享:如何使用户字符串不可变? - Sharing via ACTION_SEND: How to make string immutable by user? Android:通过Intent.ACTION_SEND共享(某事),然后自动返回我的应用程序 - Android: Sharing (something) via Intent.ACTION_SEND, then automatically return to my app 如何将 Flutter 应用程序发送到客户端进行测试 - How to send a flutter app to client for testing 如何在android中通过蓝牙发送媒体文件 - how to send media files via bluetooth in android 如何限制通过共享意图可接收的文件数量 - How to limit the number of files that the app can receive through sharing intent 是否可以在flutter应用程序关闭时通过平台通道从android后台服务向flutter端发送消息 - Is it possible to send a message from android background service to the flutter side via platform channels while the flutter app is close 如何通过Messenger发送来自应用的图片? - How to send image from app via messenger? 如何在线托管 Flutter App Data 文件? - How to host Flutter App Data files online? 通过ShareActionProvider与社交媒体共享文件 - Sharing files with social-media via ShareActionProvider
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM