語言

IntentUriType 列舉

定義

列舉由 、 、 及UriIntentScheme成員回傳的值,並作為 None 及 Scheme 成員的參數。

此列舉支援其成員值的位元組合。

[System.Flags]
public enum IntentUriType
[<System.Flags>]
type IntentUriType = 
繼承
IntentUriType
屬性

欄位

名稱 值 Description
None 0

規定不設定任何 URI 編碼標誌。

Scheme 1

用於 toUri(int) 與 parseUri(String, int) 的標記:URI 字串始終採用「intent:」方案。 這個語法可用於日後想區分用來描述意圖的 URI,與所有應視為原始 URI 的 URI。 當與 parseUri(String, int) 一起使用時,任何其他方案都會對該原始 URI 產生一個通用的 VIEW 動作。

AndroidAppScheme 2

用於序列化及解析 URI 方案中 android-app: 意圖的標記。 此格式對於傳送至特定套件的 HTTP 或 HTTPS URI 非常有用:

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

只需提供套件 ID。 主機需要一個方案,而路徑則需要方案與主機。 該 #Intent; 片段可在無方案、主機或路徑的情況下使用。 此格式無法搭配選擇器使用,因為基底意圖有明確的套件名稱。

範例,每個範例包含 package com.example.app:

  • android-app://com.example.app:行動 ACTION_MAIN。
  • android-app://com.example.app/http/example.com: 行動 ACTION_VIEW, 資料 http://example.com/。
  • android-app://com.example.app/http/example.com/foo?1234: 行動 ACTION_VIEW, 資料 http://example.com/foo?1234。
  • android-app://com.example.app/#Intent;action=com.example.MY_ACTION;end:行動 com.example.MY_ACTION。
  • android-app://com.example.app/http/example.com/foo?1234#Intent;action=com.example.MY_ACTION;end: 行動 com.example.MY_ACTION, 資料 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: 作用 com.example.MY_ACTION、 整數額外 some_int=100、 及字串額外 some_str=hello。
AllowUnsafe 4

標記用於允許 ParseUri(String, IntentUriType) 解析不安全資訊。 若無此標記, GrantReadUriPermission則 、 GrantWriteUriPermission、 GrantPersistableUriPermission、 從 GrantPrefixUriPermission 解析意圖中移除。 當此標誌被設定時,這些標誌可能會被保留,並可能導致意外的資料存取。 如果你不信任 URI 來源,請採取進一步措施保護自己。 特別是在使用意圖啟動活動時,通常應該加入 CategoryBrowsable 限制能處理該活動的活動。

備註

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於