Megosztás a következőn keresztül:


DocumentsContract.CreateWebLinkIntent(ContentResolver, Uri, Bundle) Method

Definition

Creates an intent for obtaining a web link for the specified document.

[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

Parameters

content
ContentResolver
uri
Uri

uri for the document to create a link to.

options
Bundle

Extra information for generating the link.

Returns

an intent sender to obtain the web link, or null if the document is not linkable, or creating the intent sender failed.

Attributes

Remarks

Creates an intent for obtaining a web link for the specified document.

Note, that due to internal limitations, if there is already a web link intent created for the specified document but with different options, then it may be overridden.

Providers are required to show confirmation UI for all new permissions granted for the linked document.

If list of recipients is known, then it should be passed in options as Intent#EXTRA_EMAIL as a list of email addresses. Note, that this is just a hint for the provider, which can ignore the list. In either case the provider is required to show a UI for letting the user confirm any new permission grants.

Note, that the entire options bundle will be sent to the provider backing the passed uri. Make sure that you trust the provider before passing any sensitive information.

Since this API may show a UI, it cannot be called from background.

In order to obtain the Web Link use code like this:

<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>

Java documentation for android.provider.DocumentsContract.createWebLinkIntent(android.content.ContentResolver, android.net.Uri, android.os.Bundle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to