The VibrateService allows a developer to start and stop vibration of the device via a service.

Available for
WPF / Silverlight / WP7 / WP7 Mango

Test/Emulation service available: no

Starting vibration
To start the vibration, use the following code (will vibrate for 250 ms). Note that the timespan must be between 0 and 5 seconds.

var vibrateService = GetService<IVibrateService>();
vibrateService.Start(new TimeSpan(0, 0, 0, 0, 250);

Stopping the vibration earlier than initially planned
By default, the vibration stops automatically after the specified timespan has passed. However, it is possible to stop the vibration manually.

var vibrateService = GetService<IVibrateService>();
vibrateService.Stop();

Last edited Jul 21, 2011 at 6:29 AM by GeertvanHorrik, version 1

Comments

No comments yet.