gpt4 book ai didi

android - 如何从 Android 应用程序发送/打开电子邮件附件?

转载 作者:搜寻专家 更新时间:2023-11-01 07:41:18 24 4
gpt4 key购买 nike

我想以某种方式将文件从我在一台 Android 设备上的应用程序发送到我在另一台设备上的应用程序。这可以通过任何方式完成,如果你能告诉我如何通过网络发送或类似的东西,我愿意接受建议。

目前,我正在考虑将文件作为电子邮件附件发送,但我还没有找到任何关于如何执行此操作的好文档。我需要两件事来完成此操作,能够将我的文件(存储在 SD 卡或设备上的某个位置)作为附件发送,并让我的应用程序被 android 识别为打开文件扩展名 (.lst) 的附件的应用程序.

有什么想法吗?

如果有区别的话,这些文件都是相当小的 xml 文本文件。

最佳答案

I would like to somehow send a file from my app on one android device to my app on another device. This can be done any which way, and I'm open to suggestions if you can tell me how to send over network or something like that.

编写 Web 服务。或者使用 Amazon SQS。

be able to send my file (stored on sd card or somewhere on device) as an attachment

如上所写here ,你可以试试:

Intent sendIntent = new Intent(Intent.ACTION_SEND);

sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
sendIntent.putExtra(Intent.EXTRA_STREAM, ...);
sendIntent.setType(...);

第一个省略号是您选择的文件的路径,第二个省略号是合适的 MIME 类型。

and have my app recognized by android as the app to open an attachment with the file extention (.lst)

永远不要依赖文件扩展名。使用 MIME 类型。您可以使用意向过滤器设置 Activity ,为您的 MIME 类型提供 ACTION_VIEW 支持。

关于android - 如何从 Android 应用程序发送/打开电子邮件附件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2033818/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com