2个URI的区别

发布于 2024-09-25 17:00:34 字数 519 浏览 0 评论 0原文

我正在尝试保存附件(彩信和 GMail)

Uri uri; 
uri = Uri.parse("content://mms/part/" + mmsPartId);  
uri = Uri.parse("content://gmail-ls/messages/[email protected]/messageId/attachments/0.1/BEST/true");

InputStream inputStream = getContentResolver().openInputStream(uri);

openInputStream 对于彩信工作正常,但对于 GMail 我收到错误: “打开SD卡上带有附件直接路径的附件”

我不明白什么是“附件直接路径”?

I'm trying to save attachment (mms and GMail)

Uri uri; 
uri = Uri.parse("content://mms/part/" + mmsPartId);  
uri = Uri.parse("content://gmail-ls/messages/[email protected]/messageId/attachments/0.1/BEST/true");

InputStream inputStream = getContentResolver().openInputStream(uri);

openInputStream works fine for mms, but for GMail i got error:
"open attachments that are on the sd card with the direct path to the attachment"

I don't understand what "direct path to the attachment"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

糖粟与秋泊 2024-10-02 17:00:34

使用这样的手写字符串非常可能会导致您编写的应用程序崩溃。特别是,SDK 中没有与 gmail 交互的定义。 Gmail不是 SDK 的一部分。你不能指望它能起作用;这是gmail的一个实现细节,可以随时任意更改。 (Gmail 甚至不是该平台的一部分;它基本上只是一些随机的应用程序,恰好是由 Google 编写的,您正试图深入其中。)

Using hand-written strings like this is very likely to result in you writing an app that breaks. In particular -- there is no definition in the SDK for interacting with gmail. Gmail is not part of the SDK. You can't count on this working; it is an implementation detail of gmail that can change arbitrarily at any time. (Gmail isn't even part of the platform; it is basically just some random app, that happens to be written by Google, that you are trying to poke inside of.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文