Over a million developers have joined DZone.

Make Your Windows Phone Vibrate with PhoneGap

· Mobile Zone

The Windows Phone SDK in Silverlight provides the class VibrateController which the developer can use to make the phone vibrate.

All that the developer has to do is create an instance of the VibrateController and call the start method with the timespan.

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


Check How to make a Windows Phone 7 Vibrate using C# to learn more.

Similarly, PhoneGap provides the notification.vibrate method to make your Windows Phone vibrate.

The navigator.notification.vibrate takes one argument i.e the milliseconds to vibrate your Windows Phone.

navigator.notification.vibrate(milliseconds)

<script type="text/javascript">

function Button1_onclick()

{ navigator.notification.vibrate(20000) }

</script>

 

Topics:

Published at DZone with permission of Senthil Kumar, 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 }}