NotificationManager.CreateNotificationChannel(NotificationChannel) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立一個通知頻道,通知可以發布。
[Android.Runtime.Register("createNotificationChannel", "(Landroid/app/NotificationChannel;)V", "GetCreateNotificationChannel_Landroid_app_NotificationChannel_Handler", ApiSince=26)]
public virtual void CreateNotificationChannel(Android.App.NotificationChannel channel);
[<Android.Runtime.Register("createNotificationChannel", "(Landroid/app/NotificationChannel;)V", "GetCreateNotificationChannel_Landroid_app_NotificationChannel_Handler", ApiSince=26)>]
abstract member CreateNotificationChannel : Android.App.NotificationChannel -> unit
override this.CreateNotificationChannel : Android.App.NotificationChannel -> unit
參數
- channel
- NotificationChannel
NotificationChannel:要建立的頻道。 請注意,所建立的通道可能與此值不同。 若所提供的通道格式錯誤,將拋出遠端例外。 這個值不可能為零值。
- 屬性
備註
建立一個通知頻道,通知可以發布。 這也可用於恢復已刪除的頻道,以及更新現有頻道的名稱、描述、群組和/或重要性。 只有在地區變更或用戶重新命名此頻道時,才應更改名稱與描述。 例如,如果使用者有一個名為「Messages」的頻道,且用戶更改了地點,該頻道名稱應更新為新區域中「Messages」的翻譯。 只有當新頻道的重要性低於目前值且使用者未更改該頻道的任何設定時,其重要性才會被更改。 只有當該頻道尚未屬於某群組時,群組或現有頻道才會被更改。 其他欄位則忽略已存在的通道。
Android 參考資料。android.app.NotificationManager.createNotificationChannel
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。