我发出了声音通知,当它发出声音但永远不会停止。有没有办法限制通知的声音时间?
这是我的通知代码
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);