Notification.Builder builder = new Notification.Builder(this) .setContentTitle("مانیتورینگ") .setContentText(content) .setSmallIcon(R.drawable.ic_monitoring) .setContentIntent(pIntent) .setOngoing(true); //.setPriority(Notification.PRIORITY_MAX) if (count > 0) { builder.setSound(alarmSound); builder.setOnlyAlertOnce(true); builder.setLights(Color.RED, 500, 500); // 0 : Start without a delay // 400 : Vibrate for 400 milliseconds // 200 : Pause for 200 milliseconds // 400 : Vibrate for 400 milliseconds long[] pattern = new long[]{0, 400, 200, 400}; builder.setVibrate(pattern); } Notification notification = builder.build();
References
https://stackoverflow.com/questions/15809399/android-notification-sound
https://gist.github.com/nieldeokar/e05fffe4d639dfabf0d57e96cb8055e2