語言

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

用於 toUri(int) 與 parseUri(String, int) 的標記:URI 字串始終帶有「android-app:」的 scheme。 這是 URI_INTENT_SCHEME 的變體,其格式較簡單,適用於將 http/https URI 送達特定套件名稱的情況。 格式為:android - 應用程式 : //{package_id}[/{scheme}[/{host}[/{path}]][#Intent;{...}] 在此方案中,只需package_id。 如果你包含主持人,也必須包含一個方案;包含路徑也需要主機與方案。 最後一個 #Intent;片段可無需方案、主機或路徑即可使用。 請注意,若意圖有 setSelector(Intent) ,則此方法無法使用,因為基礎意圖始終會有一個明確的套件名稱。 此方案如何映射到 Intent 物件的一些例子:URI Intent android-app://com.example.app 動作:ACTION_MAIN 套件:com.example.app android-app://com.example.app/http/example.com 動作:ACTION_VIEW 資料: http://example.com/ 套件:com.example.app 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;動作=com.example.MY_ACTION;結束動作:com.example.MY_ACTION 套件:com.example.app android-app://com.example.app/http/example.com/foo?1234 #Intent;動作=com.example.MY_ACTION;結束 動作:com.example.MY_ACTION資料: http://example.com/foo?1234 套件:com.example.app android-app://com.example.app/ #Intent;動作=com.example.MY_ACTION;i.some_int=100;S.some_str=hello;結束動作:com.example.MY_ACTION 套件:com.example.app 額外: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限制能應付該活動的範圍。

備註

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

適用於