I try to disable vibration when showing a notification.
Func:
public static Notification buildNotifForUploaderService(Context ctx, String
Add this line to your code to stop vibration:
notificationChannel.enableVibration(false);
// Above line will disable your vibration for the notification
Also, remove the vibration pattern.
So, your updated code will be:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH);
//setting pattern to disable vibrating
notificationChannel.enableVibration(false);
notificationBuilder = new NotificationCompat.Builder(ctx, CHANNEL_ID);
} else {
notificationBuilder = new NotificationCompat.Builder(ctx);
notificationBuilder.setVibrate(new long[]{0L});
}