DocumentsContract.CreateWebLinkIntent(ContentResolver, Uri, Bundle) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立取得該文件連結的意圖。
[Android.Runtime.Register("createWebLinkIntent", "(Landroid/content/ContentResolver;Landroid/net/Uri;Landroid/os/Bundle;)Landroid/content/IntentSender;", "", ApiSince=26)]
public static Android.Content.IntentSender? CreateWebLinkIntent(Android.Content.ContentResolver content, Android.Net.Uri uri, Android.OS.Bundle? options);
[<Android.Runtime.Register("createWebLinkIntent", "(Landroid/content/ContentResolver;Landroid/net/Uri;Landroid/os/Bundle;)Landroid/content/IntentSender;", "", ApiSince=26)>]
static member CreateWebLinkIntent : Android.Content.ContentResolver * Android.Net.Uri * Android.OS.Bundle -> Android.Content.IntentSender
參數
- content
- ContentResolver
- uri
- Uri
用 URI 來建立文件連結。
- options
- Bundle
產生連結的額外資訊。
傳回
意圖發送者無法取得網頁連結,或若文件不可連結則為空,或建立意圖發送者失敗。
- 屬性
備註
建立取得該文件連結的意圖。
請注意,由於內部限制,若已為指定文件建立的網頁連結意圖但選項不同,則可能會被覆寫。
提供者必須為所有新授權提供確認介面。
如果收件人清單已知,則應以電子郵件地址清單的形式在選項 Intent#EXTRA_EMAIL 中傳遞。 請注意,這只是給提供者的提示,他們可以忽略該清單。 無論哪種情況,提供者都必須顯示使用者確認任何新權限授權的介面。
請注意,整 options 套方案將被送往支持已通過 uri的醫療提供者。 在傳遞任何敏感資訊前,務必先信任該服務提供者。
由於此 API 可能顯示使用者介面,無法從背景呼叫。
為了取得網路連結,請使用以下程式碼:
<code>
void onSomethingHappened() {
IntentSender sender = DocumentsContract.createWebLinkIntent(<i>...</i>);
if (sender != null) {
startIntentSenderForResult(
sender,
WEB_LINK_REQUEST_CODE,
null, 0, 0, 0, null);
}
}
<i>(...)</i>
void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == WEB_LINK_REQUEST_CODE && resultCode == RESULT_OK) {
Uri weblinkUri = data.getData();
<i>...</i>
}
}
</code>
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。