views:

61

answers:

1

I want to vibrate the phone in the same way as the incoming call in sync with the ringtone. How do I achieve it?

+2  A: 
  • Get an MP3 library that gives you feedback for magnitude of sound (Something like equalizer in winamp)
  • Normalize this magnitude to a scale of [0,1]
  • As the android vibrator api supports only vibration duration (not intensity) you need to discretize this magnitude to either 0 or 1 (for some small duration).
  • If the magnitude of sound is less than some value, 0.5, do not vibrate for that duration. Else vibrate.
Ankit Jain