语言

IntentUriType 枚举

定义

枚举由 UriIntentSchemeNone 成员的参数返回Scheme的值。

此枚举支持其成员值的按位组合。

[System.Flags]
public enum IntentUriType
[<System.Flags>]
type IntentUriType = 
继承
IntentUriType
特性

字段

名称 值 说明
None 0

指定未设置 URI 编码标志。

Scheme 1

用于 toUri(int) 和 parseUri(String, int) 的标志:URI 字符串始终具有“intent:”方案。 当希望以后在 URI 之间消除旨在描述意向的 URI 与应视为原始 URI 的所有其他 URI 之间消除歧义时,可以使用此语法。 与 parseUri(String, int) 一起使用时,任何其他方案都将导致该原始 URI 的通用 VIEW 操作。

AndroidAppScheme 2

用于 toUri(int) 和 parseUri(String, int) 的标志:URI 字符串始终具有“android-app:”方案。 这是URI_INTENT_SCHEME的变体,对于要传递到特定包名称的 http/https URI,其格式更简单。 格式为:android-app://{package_id}[/{scheme}[/{host}[/{path}]]][#Intent;{...}] 在此方案中,只需要package_id。 如果包含主机,则还必须包含方案;包括路径也需要主机和方案。 最终 #Intent;可以在不使用方案、主机或路径的情况下使用片段。 请注意,这不能与具有 setSelector(Intent) 的意向一起使用,因为基本意向将始终具有显式包名称。 此方案如何映射到意向对象的示例:URI 意向 android-app://com.example.app 操作:ACTION_MAIN包:com.example.app android-app://com.example.app/http/example.com 操作:ACTION_VIEW数据:包 com.example.app: http://example.com/ android-app://com.example.app/http/example.com/foo?1234 操作:ACTION_VIEW数据:包: http://example.com/foo?1234 com.example.app android-app://com.example.app/#Intent;action=com.example.MY_ACTION;end Action: com.example.MY_ACTION Package: com.example.app android-app://com.example.app/http/example.com/foo?1234 #Intent;action=com.example.MY_ACTION;end Action: com.example.MY_ACTION Data: Package: http://example.com/foo?1234 com.example.app 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 Package: com.example.app Extras: some_int=(int)100 some_str=(String)hello

AllowUnsafe 4

用于 toUri(int) 和 parseUri(String, int) 的标志:允许分析不安全的信息。 具体而言,可以设置标志FLAG_GRANT_READ_URI_PERMISSION、FLAG_GRANT_WRITE_URI_PERMISSION、FLAG_GRANT_PERSISTABLE_URI_PERMISSION和FLAG_GRANT_PREFIX_URI_PERMISSION标志,以便生成的意向可能导致意外的数据访问。 如果不信任要分析的 URI 源,仍应执行进一步处理,以保护自己免受此分析。 具体而言,使用活动启动活动时,通常应添加CATEGORY_BROWSABLE来限制可以处理的活动。

注解

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于