Over a million developers have joined DZone.

The VibrateController Class for Windows Phone

· Mobile Zone

I 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…

Topics:

Published at DZone with permission of Andrea Haubner, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}