Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to make a Windows Phone 7 Vibrate using C#

DZone's Guide to

How to make a Windows Phone 7 Vibrate using C#

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

Vibrate your phone?  Why?  Well, there are many reasons or situations that are suitable for phone vibrations.  Some of them include the notifications that are sent to the WP7 or when the user should actually feel that he has touched / clicked a button on the Phone.

Fortunately, the Windows Phone 7 SDK allows the developers to control the vibrate function easily.

The Class VibrateController allows the developers to do this task.

The VibrateController class is defined in the namespace Microsoft.Devices.

private void button1_Click(object sender, RoutedEventArgs e)
{

       VibrateController vibrate = VibrateController.Default;
       vibrate.Start(TimeSpan.FromMilliseconds(1000));

}

You can use the methods Start and Stop of VibrateController to switch on / off the Vibrate controller

Reference

VibrateController Class


Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:

Published at DZone with permission of Senthil Kumar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}