Vibrating a smartphone is one of the possible approaches to inform a user about important events. In this recipe, you will learn how to programmatically start vibrations.
As an example, you will prepare a simple page with the Start vibrations button. After clicking on it, the vibrations should be started only for 1 second.
To prepare an example that launches vibrations, perform the following steps:
Add a reference to Windows Mobile Extensions for the UWP. To do so, choose Add | Reference... from the context menu of the project node in the Solution Explorer window, click on Universal Windows | Extensions in the Reference Manager window on the left, and choose a version of Windows Mobile Extensions for the UWP, such as 10.0.10240.0, as shown in the following screenshot:
Add the button to launch the vibrations by modifying the content of the
MainPage.xaml
file, as shown...