Android Notification to play sound only

后端 未结 4 2133
清歌不尽
清歌不尽 2020-12-09 12:41

I have a countdown timer in my activity and when it reaches zero I send a notification to the status bar which also plays a custom wav file to alert the user. I only want t

4条回答
  •  醉话见心
    2020-12-09 13:21

    NotificationCompat.Builder builder= new NotificationCompat.Builder(this);
    

    three ways to setSound

    builder.setDefaults(Notification.DEFAULT_SOUND);
    builder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
    builder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI);
    

提交回复
热议问题