1

i Have used it with notification builder

  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);
}

Still i am getting continuous sound.
how to solve it?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Gautam Kumar
  • 1,385
  • 14
  • 17

0 Answers0