Reputation: 11747
I'm developing an app and need to completely turn off vibration alerts when my app is running. For example if an call comes in while my app is open I don't want to have the vibration alert, the same with emails and anyother notification.
So I've been googling around for a while and found this:
AudioManager amanager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
amanager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,AudioManager.VIBRATE_SETTING_OFF);
The problem is that this method is deprecated. And I can't find an other way of doing this.
The minSdkVersion = 9 and targetSdkVersion = 17.
Any idea?
Thanks!!
Upvotes: 1
Views: 496
Reputation: 11892
It should now be
AudioManager amanager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
amanager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
Upvotes: 2