[英]how to disable sound on push notification?
我看到了文檔 :
public Uri sound
Added in API level 1
The sound to play.
To play the default notification sound, see defaults.
但是如何禁用聲音播放? 發送Uri == null
?
如果不使用NotificationBuilder調用setSound(uri),則無法播放聲音。 例如。 以下內容將播放通知的默認聲音:
Uri alarmSound = RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("title")
.setSound(alarmSound);
只需刪除“.setSound(alarmSound)”即可播放聲音,如:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("title");
希望我的問題正確(?)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.