Språk

IntentUriType Enum

Definition

Enumerates values returned by the UriIntentScheme, None, and Scheme members and taken as a parameter of the F:Android.Content.Intent.ParseUri, and F:Android.Content.Intent.ToUri members.

This enumeration supports a bitwise combination of its member values.

[System.Flags]
public enum IntentUriType
[<System.Flags>]
type IntentUriType = 
Inheritance
IntentUriType
Attributes

Fields

Name Value Description
None 0

Specifies that no URI encoding flags are set.

Scheme 1

Flag for use with toUri(int) and parseUri(String, int) : the URI string always has the "intent:" scheme. This syntax can be used when you want to later disambiguate between URIs that are intended to describe an Intent vs. all others that should be treated as raw URIs. When used with parseUri(String, int) , any other scheme will result in a generic VIEW action for that raw URI.

AndroidAppScheme 2

Flag for serializing and parsing an intent in the android-app: URI scheme. This format is useful for an HTTP or HTTPS URI delivered to a specific package:

android-app://{package_id}[/{scheme}[/{host}[/{path}]]][#Intent;{...}]

Only the package ID is required. A host requires a scheme, and a path requires both a scheme and a host. The #Intent; fragment can be used without a scheme, host, or path. This format cannot be used with a selector because the base intent has an explicit package name.

Examples, each with package com.example.app:

  • android-app://com.example.app: action ACTION_MAIN.
  • android-app://com.example.app/http/example.com/: action ACTION_VIEW, data http://example.com/.
  • android-app://com.example.app/http/example.com/foo?1234: action ACTION_VIEW, data http://example.com/foo?1234.
  • android-app://com.example.app/#Intent;action=com.example.MY_ACTION;end: action com.example.MY_ACTION.
  • android-app://com.example.app/http/example.com/foo?1234#Intent;action=com.example.MY_ACTION;end: action com.example.MY_ACTION, data http://example.com/foo?1234.
  • android-app://com.example.app/#Intent;action=com.example.MY_ACTION;i.some_int=100;S.some_str=hello;end: action com.example.MY_ACTION, integer extra some_int=100, and string extra some_str=hello.
AllowUnsafe 4

Flag for use with ParseUri(String, IntentUriType) to allow parsing of unsafe information. Without this flag, GrantReadUriPermission, GrantWriteUriPermission, GrantPersistableUriPermission, and GrantPrefixUriPermission are removed from the parsed intent. When this flag is set, those flags can be retained and can cause unexpected data access. If you do not trust the URI source, take further steps to protect yourself. In particular, when using the intent to start an activity, you should usually add CategoryBrowsable to limit the activities that can handle it.

Remarks

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