Reputation:
I have some buttons and need my phone vibrate on touch this buttons.
How I can do this?
Code of button for example
Button sushi = FindViewById<Button> (Resource.Id.sushiButton);
sushi.Click += delegate {
var intent24 = new Intent (this, typeof(SushiActivity));
StartActivity (intent24);
};
Upvotes: 0
Views: 709
Reputation: 89129
to vibrate, do this (assuming you are calling from within an Activity):
Vibrator vib = (Vibrator)this.GetSystemService(Context.VibratorService);
vib.Vibrate(50);
You will also need to enable this permission in your Manifest:
<uses-permission android:name="android.permission.VIBRATE"/>
Upvotes: 1