cuốn sách gpt4 ai đã làm

android - 为什么 Android 上的 Google 云端硬盘应用程序不发送文件 ://URIs anymore?

In lại Tác giả: Vũ trụ không gian 更新时间:2023-11-03 13:16:25 27 4
mua khóa gpt4 Nike

Google 云端硬盘过去常常发送 tài liệu:// URI 作为 ACTION_VIEW Intent 的数据。它现在改为发送 content:// URI。为什么会发生这种变化?

câu trả lời hay nhất

自 2016 年 2 月 17 日起,云端硬盘应用不再向其他应用发送 tài liệu:// URI。这样做是为了提高安全性,并且自 2013 年以来一直受到 Android 的鼓励。

可以使用 ContentResolver 将内容 URI 解析为 ParcelFileDescriptor,如下所示:

Ý định ý định = getIntent();
if (Intent.ACTION_VIEW.equals(intent.getAction()) {
Uri incomingData = getIntent().getData();
ParcelFileDescriptor pfd =
getContentResolver().openFileDescriptor(incomingData, "r");
// Use file ...
}

此外,应用不应再使用将 URI 限制为文件方案的 Intent 过滤器:





Mime 类型和其他过滤器将继续工作并受到鼓励:





关于 file sharing 的更多信息和内容 URI 可以在 developer.android.com 找到。

关于android - 为什么 Android 上的 Google 云端硬盘应用程序不发送文件 ://URIs anymore?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35351652/

27 4 0
không gian vũ trụ
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress