I am defining a custom vibration for a specific functionality when notification is received.
However, when the phone screen is off, the custom vibration plays along with the default notification vibration.
I tried to put phone to silent mode and remove it from silent mode programmatically and also tried to use a partial wakelock, suspecting that when the CPU is off, then the default vibration is also thrown, but both approaches don't seem to work.
I also tried to mute the default audio and the vibration and restore it upon completion of my task on receiving a notification, but that only helps in masking the default notification sound, not the default vibration.
//Trying to mute the notification sound and vibration
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
//Restoring the defaults
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, defaultNotifVolume, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
Please let me know how to disable/enable the default notification vibration programmatically.