我用声音发出通知,当它发出通知时,发出声音,但从不停止。有没有办法限制通知的发声时间?
这是我的通知代码
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);发布于 2013-05-26 13:10:03
我认为您需要将TYPE_ALARM更改为TYPE_NOTIFICATION。
https://stackoverflow.com/questions/16756111
复制相似问题