通知播放声音
程序员文章站
2022-05-16 22:27:27
...
NotificationManager nm_krf = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification_krf = new Notification();
//直接播放系统的默认通知音
notification_krf.defaults |= Notification.DEFAULT_SOUND;
//自定义
//notification.sound =Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.mm);
nm_krf.notify(1, notification_krf);