I would like to disable sound and vibration for all incoming notifications. I don't mind if phone call vibration gets switched off, too. But the users volume settings for phone calls shouldn't be touched.
Thanks to the AudioManager, muting the sound of notifications is easy:
audioManager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true);
Disabling the vibration of notifications, however, is harder than expected.
The AudioManager has this deprecated method for vibration settings:
audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_OFF)
This, however, seems to have no effect on my Android 5.0 device and I can't find any alternatives. :(
I know that Lollipop has introduced the stuff around "Priority Mode" but I do not want to fiddle with modes. Switching the mode would probably have some other side-effect (based on the users priority preferences).
Any ideas how to mute notification sound and vibration on Android 5.0+?