語言

Notification.Builder.SetFullScreenIntent(PendingIntent, Boolean) 方法

定義

意圖啟動,而不是在狀態欄發布通知。

[Android.Runtime.Register("setFullScreenIntent", "(Landroid/app/PendingIntent;Z)Landroid/app/Notification$Builder;", "GetSetFullScreenIntent_Landroid_app_PendingIntent_ZHandler")]
public virtual Android.App.Notification.Builder SetFullScreenIntent(Android.App.PendingIntent? intent, bool highPriority);
[<Android.Runtime.Register("setFullScreenIntent", "(Landroid/app/PendingIntent;Z)Landroid/app/Notification$Builder;", "GetSetFullScreenIntent_Landroid_app_PendingIntent_ZHandler")>]
abstract member SetFullScreenIntent : Android.App.PendingIntent * bool -> Android.App.Notification.Builder
override this.SetFullScreenIntent : Android.App.PendingIntent * bool -> Android.App.Notification.Builder

參數

intent
PendingIntent

PendingIntent:即將啟動的意圖

highPriority
Boolean

布林值:即使其他通知被抑制,通過 true 也會使此通知被發送

傳回

這個 Android.App.Notification.Builder 實例,允許通話串接。

屬性

備註

意圖啟動,而不是在狀態欄發布通知。 僅用於極高優先順序、需用戶立即關注的通知,例如來電或鬧鐘,且使用者已明確設定為特定時間。 如果這個功能被用於其他用途,請給使用者一個選項,可以關閉它並使用一般通知,因為這可能會非常干擾。 針對Build.VERSION_CODES的應用程式。Q 及以上的使用者必須申請權限(Manifest.permission.USE_FULL_SCREEN_INTENT)才能使用全螢幕意圖。

在Build.VERSION_CODES之前。TIRAMISU 中,系統可能會顯示抬頭通知(該通知在螢幕上顯示時間可能比其他抬頭通知更長),而非啟動意圖,而使用者正在使用裝置時。 Build.VERSION_CODES。TIRAMISU 系統介面會在使用者使用裝置時顯示抬頭通知,而非啟動此意圖。 此通知會以強調的動作按鈕顯示。 如果發文應用程式保留Manifest.permission.USE_FULL_SCREEN_INTENT,提示通知會持續出現,直到使用者關閉或暫停,或應用程式取消為止。 如果發文應用程式沒有保留Manifest.permission.USE_FULL_SCREEN_INTENT,那麼即使螢幕鎖定或關閉,通知仍會以提醒通知的形式出現,且這個通知只會持續 60 秒。

若要以全螢幕意圖啟動,通知也必須發布到重要性設定為IMPORTANCE_HIGH或更高的頻道。

另請參閱:

Android 參考資料。android.app.Notification.Builder.setFullScreenIntent

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

適用於