i create notification channel to show notification in android 8.0 as below
NotificationChannel uploadChannel = new NotificationChannel(Constants.NOTIFICATION_CHANNEL_UPLOAD_ID,"Uploads", NotificationManager.IMPORTANCE_LOW);
uploadChannel.enableLights(false);
uploadChannel.setDescription("Uploads Channel");
notificationManager.createNotificationChannel(uploadChannel);
each time i show notification the phone vibrate many times. i disable vibrate from notification channel as below
uploadChannel.enableVibration(false);
i create notification as below
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_UPLOAD_ID);
but it is not working phone is vibrating with each notification.
In addition to Ahmadul Hoq's answer, which did work for me, I would like to add that you may need to remove the app and reinstall it before the vibration changes take place. The channel keeps its initial settings and stays alive if the app is killed - so changes may not be applied if you simply build and run.
This is a bug on Android 8 notification system. I've tinkered with different combinations of
enableVibration
withsetVibrationPattern(null)
but it does not work.Only solution that stops the vibration for me is this:
FYI, even if I set a vibration pattern with 0, but set
enableVibration
tofalse
, it vibrates.I was initially using
NotificationManager.IMPORTANCE_DEFAULT
and could not get the vibrating to stop. UsingNotificationManager.IMPORTANCE_LOW
instead resolved the issue.NotificationManager.IMPORTANCE_MIN
would also work; see here: https://developer.android.com/training/notify-user/channels#importance