我发出了一个声音通知,当它通知发出声音但从未停止。有什么办法限制通知的声音时间吗?通知声音变得无穷无尽并且永不止步
这是我的通知代码
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
context).setSmallIcon(R.drawable.icon)
.setContentTitle(title).setContentText(detail);
mBuilder.setDefaults(Notification.DEFAULT_VIBRATE);
mBuilder.setDefaults(Notification.DEFAULT_LIGHTS);
SharedPreferences pref = PreferenceManager
.getDefaultSharedPreferences(context);
String sound = pref.getString("ringtonePref", "default");
Uri uri = Uri.parse(sound);
mBuilder.setSound(uri,RingtoneManager.TYPE_ALARM);
notification.flags | = Notification.FLAG_AUTO_CANCEL; \t notification.defaults | = Notification.DEFAULT_SOUND; –