Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notification vibrate issue for android 8.0

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.

like image 214
Manish Avatar asked Sep 25 '17 10:09

Manish


People also ask

Why are my notifications not vibrating Android?

1. Open up Settings on your Android and navigate to Sound and vibration > Vibration intensity. 2. Use the sliders to increase vibration intensity for Incoming calls, Notifications, and Touch interaction.

Why did my phone stop vibrating when I get notifications?

Android: Go to the settings, then to the sounds and notifications, and check if the vibration is on. Go to the messaging menu, then to settings of messaging app, and switch on the vibration.

How do you turn on vibrate notification on Samsung?

To find this, swipe down from the top of the screen to open the Quick settings panel, and then tap the Settings icon. Tap Sounds and vibration, and then tap Notification sound.


2 Answers

This is a bug on Android 8 notification system. I've tinkered with different combinations of enableVibration with setVibrationPattern(null) but it does not work.

Only solution that stops the vibration for me is this:

mNotificationChannel.setVibrationPattern(new long[]{ 0 });
mNotificationChannel.enableVibration(true);

FYI, even if I set a vibration pattern with 0, but set enableVibration to false, it vibrates.

like image 60
Ahmadul Hoq Avatar answered Oct 18 '22 10:10

Ahmadul Hoq


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.

like image 31
Roland van der Linden Avatar answered Oct 18 '22 09:10

Roland van der Linden