Quick Tip: Windows Phone Vibration With VibrateController
Join the DZone community and get the full member experience.
Join For Freei am currently working on another windows phone application, where i needed a way to show the user that they had successfully performed a task and therefore unlocked another feature inside the application.
first idea was adding some sound, but somehow i was not happy with that. so i thought, why not let the phone vibrate?
it’s actually not that hard. the windows phone 7 sdk allows me to control the vibrate function easily.
in the namespace microsoft.devices there is a class defined with the name ‘vibratecontroller’.
the only code i need for that function is:
when the user clicks the particular button, the phone vibrates.
a few thoughts to keep in mind:
1. the shortest vibration / pause is 0.1 seconds.
2. the longest is 5 seconds, but that is not recommended.
3. 3 vibrations in one sequence are enough.
4. 0.2 / 0.3 are good choices for an alert.
here you can find more information about the vibratecontroller class .
to be continued…
Published at DZone with permission of Andrea Haubner, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments