Search code examples
c#androidxamarinvibration

Vibration on Xamarin Android


Im currently working on an application using Xamarin android. I cannot get the device to vibrate though.

Vibrator vibrator = (Vibrator)Activity.GetSystemService(Context.VibratorService);
vibrator.Vibrate(100);

It builds but crashes when I press the button that is linked to the code.


Solution

  • This solves the problem AndroidManifest.xml

    <uses-permission android:name="android.permission.VIBRATE"/>