Question

I have an issue with an application: even if ringer mode is RINGER_MODE_VIBRATE and vibrate setting is VIBRATE_SETTING_ON, my phone does not vibrate. Here is my code:

AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);

Note: I am using this code in a broadcast receiver, when the device is ringing (state is TelephonyManager.EXTRA_STATE_RINGING)

THanks.

Was it helpful?

Solution

did you set on the permission in the manifest file?

<uses-permission android:name="android.permission.VIBRATOR" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top