Flo
Flo

Reputation: 27455

Android: Ringer mode changed to silent doesn't stop the phone vibrating

I'm trying to change the ringer mode of the phone to RINGER_MODE_SILENT when a call is incoming by using the following lines of code.

AudioManager am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
am.setRingerMode(AudioManager.RINGER_MODE_SILENT);

While the phone stops ringing it continue to vibrate although the documentation of RINGER_MODE_SILENT says it should also stop vibrating.

I'm using the SDK 1.6

UPDATE:

As I didn't find a solution yet, I tried to deactivate the vibration settings manually.

am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF );

But this also doesn't prevent the phone form vibrating when a call is incoming.

Any ideas?

UPDATE 2:

Today I tried to solve the problem by canceling the vibration via a Vibration object.

Vibrator vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vib.cancel();

Again, without success. Now I'm running out of ideas and asking myself if it is possible to stop the vibration at all.

UPDATE 3:

I've discovered another interesting fact when I've reread the documentation of the Vibrator class. The documentation says:

"If your process exits, any vibration you started with will stop."

This sounds to me as if the vibration is linked to the process that started it and cannot be accessed form another process.

Upvotes: 10

Views: 5005

Answers (3)

androidjutsu
androidjutsu

Reputation: 26

I too am having trouble turning this feature off.

I have used AudioManager setVibrateSetting(), chucking in AudioManager.VIBRATE_TYPE_NOTIFICATION and 0, but it still vibrates when a text message is received.

I'm wondering if there is a way to completely override this feature now.

I think Vibrator's cancel() method is for a vibration that is currently in progress.

Upvotes: 0

user942821
user942821

Reputation:

Have you tried permission MODIFY_AUDIO_SETTINGS? SDK says: Allows an application to modify global audio settings.

Upvotes: 0

dsandler
dsandler

Reputation: 2481

Sorry, this is a known bug in the Phone app; it doesn't currently listen for AudioManager.RINGER_MODE_CHANGED_ACTION broadcasts (which would tell it to stop the ringer and vibration). I recommend filing a bug at b.android.com.

Upvotes: 2

Related Questions