NotificationChannel.SetSound(Uri, AudioAttributes) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
設定該頻道通知應播放的音效及其音訊屬性。
[Android.Runtime.Register("setSound", "(Landroid/net/Uri;Landroid/media/AudioAttributes;)V", "", ApiSince=26)]
public void SetSound(Android.Net.Uri? sound, Android.Media.AudioAttributes? audioAttributes);
[<Android.Runtime.Register("setSound", "(Landroid/net/Uri;Landroid/media/AudioAttributes;)V", "", ApiSince=26)>]
member this.SetSound : Android.Net.Uri * Android.Media.AudioAttributes -> unit
參數
- sound
- Uri
Uri
- audioAttributes
- AudioAttributes
音效屬性
- 屬性
備註
設定該頻道通知應播放的音效及其音訊屬性。 重要性至少NotificationManager.IMPORTANCE_DEFAULT的通知頻道應該會有聲音。 注意:Uri 參數中可以提供應用程式專屬音效,但由於頻道在應用程式安裝期間持續存在,且會備份與還原,因此 Uri 應該是穩定的。 因此不建議使用 ContentResolver.SCHEME_ANDROID_RESOURCE URI,因為資源 ID 在應用程式升級時可能會改變。 只有在頻道提交給 NotificationManager.createNotificationChannel(NotificationChannel)之前,才能修改。
Android 參考資料。android.app.NotificationChannel.setSound
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。