在Android上的Flutter中:如何保存非图像文件,以便用户可以在其他应用程序中立即看到它?
如何在 Android 设备上的 Flutter 应用程序中保存文件(txt/pdf/doc 等),以便可以从电子邮件客户端等任何其他应用程序访问或“用户可见”该文件?
所需的行为非常简单:
- 我的应用程序保存一个文件 - 在由 path_provider 或任何其他位置提供的自己的文件夹中。
- 用户打开任何其他可以读取设备上文件的应用程序,例如电子邮件客户端。
- 当打开典型的“附加文件”对话框或 w/e 时,用户可以立即看到我的应用程序之前保存的文件。
听起来很基本,但到目前为止我还无法实现这个结果。我保存文件很好,并且尝试了不同的文件夹(hello path_provider),但似乎我的应用程序保存文件的位置并不重要 - 它们只是不会显示在其他应用程序中。文件不是图像,只是文档。 除此之外,我的应用程序以这种方式保存的文件显然可以通过浏览设备上的标准“文件”应用程序以及通过连接到 PC 等其他方式来访问。
有没有办法“标记”它们以供系统显示?我没有看到任何文档提到这个问题。
How can I save a file (txt/pdf/doc etc.) in my Flutter app on Android device in such a way that it will be accessible or "visible to the user" from any other app like an email client?
The desired behavior is very simple:
- My app saves a file - in its own folder provided by path_provider or any other place.
- User opens any other app that can read files on device, say an email client.
- User can instantly see the file that my app previously saved when open the typical 'Attach file' dialog or w/e.
Sounds pretty basic, but so far I could not achieve this result. I save files just fine and I tried different folders (hello path_provider), but it seems that it doesn't matter where my app saves the files - they just don't show up in other apps. Files are not images, just documents.
Beyond that, the files that my app saves this way are obviously accessible via browsing through the standard "Files" app on device and via other means like connecting to a PC.
Is there a way to "flag" them for the system to show? I don't see any documentation mentioning this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论