Search code examples
androidnotificationsvibration

How to turn off the default vibration of a notification


I am using Galaxy Nexus with Android 4.0, I set the silent mode to vibrate in Settings. I use NotificationManager.notify to send the Notification. I don't set Notification.vibrate, I even use myNotification.defaults &= ~Notification.DEFAULT_VIBRATE to disable the vibration. But it still vibrate after calling NotifcationManager.notify. Could anyone tell me how to turn off the vibration of a Notification in vibrate mode?


Solution

  • use the following code:

    notification.defaults = Notification.DEFAULT_LIGHTS;
    //or 
    notification.defaults = Notification.DEFAULT_SOUND;