# Haptic Feedback

Haptic feedback is generally manifested by a gentle vibration sensation provided by the device to give a response to the user. Some examples of haptic feedback are when a user types on a virtual keyboard or when they play a game where the player's character has an encounter with an enemy character.

## Get started <a href="#get-started" id="get-started"></a>

### Android

The `Vibrate` permission is required and must be configured in the Android project. This can be added in the following ways:

* Add the assembly-based permission:

  Open the *Platforms/Android/MainApplication.cs* file and add the following assembly attributes after `using` directives:

  ```csharp
  [assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]
  ```

{% hint style="warning" %}
This approach only applies to Wisej.NET Hybrid Local applications.
{% endhint %}

* \- or -
* Update the Android Manifest:

  Open the *Platforms/Android/AndroidManifest.xml* file and add the following in the `manifest` node:

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

  \- or -
* Update the Android Manifest in the manifest editor:

  In Visual Studio double-click on the *Platforms/Android/AndroidManifest.xml* file to open the Android manifest editor. Then, under **Required permissions** check the **VIBRATE** permission. This will automatically update the *AndroidManifest.xml* file.

## Use haptic feedback <a href="#use-haptic-feedback" id="use-haptic-feedback"></a>

The haptic feedback functionality is performed in two modes: a short **Click** or a **LongPress**. The following code example initiates a `Click` or `LongPress` haptic feedback response to the user based on which **Button** they click:

```csharp
private void HapticShortButton_Clicked(object sender, EventArgs e) =>
    Device.HapticFeedback.Perform(HapticFeedbackType.Click);

private void HapticLongButton_Clicked(object sender, EventArgs e) =>
    Device.HapticFeedback.Perform(HapticFeedbackType.LongPress);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/hybrid/development/haptic-feedback.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
