Ringer Mode Vibrate on Android

3

I would like to know if it is possible to programmatically call setRingerMode (RINGER_MODE_VIBRATE) without the device vibrating at the time the method is called?

Android has a default behavior when setting up sound mode: vibrate when we select RINGER_MODE_VIBRATE mode directly on the device. And this behavior is also repeated when done via code.

When I open the app, the sound mode of the device should be set to RINGER_MODE_NORMAL. But when closed, the previous state must be restored. Restoring RINGER_MODE_VIBRATE status vibrates.

I wish it did not vibrate when setting RINGER_MODE_VIBRATE. Is there any way to inhibit this vibration?

    
asked by anonymous 26.08.2014 / 17:31

1 answer

1

Call the startVibrate method within the method you expect to vibrate ...

private void metodoQueVibra(){
  startVibrate();
}

public void startVibrate() {
  long pattern[] = { 0, 100, 200, 300, 400 };
  vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
  vibrator.vibrate(pattern, 0);
}

Reference:

link

    
27.08.2014 / 20:10