我已将它与通知构建器一起使用
final NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NotificationChannelCreator.COMPLAIN)
.setSmallIcon(R.drawable.prescient_logo)
.setContentTitle(getString(R.string.app_name))
.setContentText(messageBody)
.setAutoCancel(true)
.setWhen(System.currentTimeMillis())
.setContentIntent(pendingIntent);
showNotification(notificationBuilder);
}
private void showNotification(NotificationCompat.Builder notificationBuilder) {
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
android.app.Notification notification = notificationBuilder.build();
notification.defaults |= Notification.FLAG_ONLY_ALERT_ONCE;
notification.flags = android.app.Notification.DEFAULT_LIGHTS | android.app.Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(12 , notification);
}
我仍在接受连续的声音 怎么解决呢?