Skip to content Skip to sidebar Skip to footer

Android: Set Power Of Vibration

I'm currently working on a project, where I'd like to use the vibrating motor situated inside the Android phone. I'd figured out, that setting the right permission in the manifest

Solution 1:

As per the below, I don't believe it's possible to control the intensity. What you could do is use short bursts so the device doesn't vibrate as fast? But I've not tested this personally.

http://developer.android.com/reference/android/os/Vibrator.html and controlling vibration intensity in android phones? is it possible?

Solution 2:

True, the API does not provide a direct way to control the vibration intensity. But as you suggested in your update, PWM can be used to produce a vibration pattern of various pulse widths, resulting in lower average voltage to the vibrator motor (and thus weaker vibration output).

I've posted a simple proof of concept method here. This method will generate a pattern based on the specified strength. The transition in that method isn't quite linear, so I have posted a bounty to hopefully get some alternate suggestions. Will update when I have an even better algorithm.

Solution 3:

The Vibrator Class does not allow for this, you can only set the pattern as well as the duration:

vibrate(long[] pattern, int repeat)

vibrate(long milliseconds)

intensity is related to Hardware "Vibration Motor"

Post a Comment for "Android: Set Power Of Vibration"