Home

Awesome

Vibrate Plugin for Xamarin and Windows

Simple and elegant way to trigger the vibration on a device in your Xamarin.iOS, Xamarin.Android, Windows, and Xamarin.Forms projects.

Setup

Build status: Build status

Migrate to: Xamarin.Essentials or .NET MAUI

I have been working on Plugins for Xamarin for a long time now. Through the years I have always wanted to create a single, optimized, and official package from the Xamarin team at Microsoft that could easily be consumed by any application. The time is now with Xamarin.Essentials, which offers over 50 cross-platform native APIs in a single optimized package. I worked on this new library with an amazing team of developers and I highly highly highly recommend you check it out.

Additionally, Xamarin.Essentials is now included in & .NET MAUI.

Due to the functionality being included "in the box" I have decided to officially archive this repo.

Platform Support

PlatformVersion
Xamarin.iOSiOS 7+
Xamarin.AndroidAPI 10+
Windows 10 UWP10+

API Usage

To gain access to the Vibrate class simply use this method:

var v = CrossVibrate.Current;
v.Vibration(TimeSpan.FromSeconds(1)); // 1 second vibration

Methods

/// <summary>
/// Vibrate the phone for specified amount of time
/// </summary>
/// <param name="vibrateSpan">Time to vibrate. 500ms is default</param>
void Vibration(TimeSpan? vibrateSpan = null);

Platform Tweaks

iOS There is no API to vibrate for a specific amount of time, so it will vibrate for the default time the system specifies (around 500 milliseconds)..

Android The android.permission.VIBRATE permission will automatically be added for you into your AndroidManifest.xml

Contributions

Contributions are welcome! If you find a bug please report it and if you want a feature please report it.

If you want to contribute code please file an issue and create a branch off of the current dev branch and file a pull request.

License

Under MIT, see LICENSE file.