The IVibrateService allows a developer to start and stop vibration of the device via a service.
To start the vibration, use the following code (will vibrate for 250 ms). Note that the time span must be between 0 and 5 seconds.
var dependencyResolver = this.GetDependencyResolver(); var vibrateService = dependencyResolver.Resolve<IVibrateService>(); vibrateService.Start(new TimeSpan(0, 0, 0, 0, 250); |
By default, the vibration stops automatically after the specified time span has passed. However, it is possible to stop the vibration manually.
var dependencyResolver = this.GetDependencyResolver(); var vibrateService = dependencyResolver.Resolve<IVibrateService>(); vibrateService.Stop(); |