PendingIntent.GetService(Context, Int32, Intent, PendingIntentFlags) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
擷取一個 PendingIntent,該意圖將啟動服務,例如呼叫 Context#startService Context.startService()。
[Android.Runtime.Register("getService", "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;", "")]
public static Android.App.PendingIntent? GetService(Android.Content.Context? context, int requestCode, Android.Content.Intent intent, Android.App.PendingIntentFlags flags);
[<Android.Runtime.Register("getService", "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;", "")>]
static member GetService : Android.Content.Context * int * Android.Content.Intent * Android.App.PendingIntentFlags -> Android.App.PendingIntent
參數
- context
- Context
此待定意圖應該啟動服務的上下文。
- requestCode
- Int32
發送者的私人請求碼
- intent
- Intent
一個描述即將啟動服務的意圖。
- flags
- PendingIntentFlags
可以是 #FLAG_ONE_SHOT、 #FLAG_NO_CREATE、 #FLAG_CANCEL_CURRENT、 #FLAG_UPDATE_CURRENT, #FLAG_IMMUTABLE 或任何由 支援 Intent#fillIn Intent.fillIn() 的旗標,用以控制實際傳送時可提供的未指定意圖部分。
傳回
回傳一個已存在或新的 PendingIntent,符合給定參數。 只有在 #FLAG_NO_CREATE 已提供時,才能回傳 null。
- 屬性
備註
取得一個 PendingIntent 來啟動服務,例如呼叫 Context.startService()。 服務的起始論點將來自意圖的額外部分。 出於安全考量,你提供的意圖幾乎應該是明確的意圖,也就是指定一個透過 Intent.setClass 交付的明確元件
Android 參考資料。android.app.PendingIntent.getService
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。