# HapticFeedbackConstantsCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/view/HapticFeedbackConstantsCompat.java+class:androidx.core.view.HapticFeedbackConstantsCompat) Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

*** ** * ** ***

<br />

```
class HapticFeedbackConstantsCompat
```

<br />

*** ** * ** ***

Helper class for accessing values in `https://developer.android.com/reference/android/view/HapticFeedbackConstants.html`.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#CLOCK_TICK() = 4` The user has pressed either an hour or minute tick of a Clock. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#CONFIRM() = 16` A haptic effect to signal the confirmation or successful completion of a user interaction. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#CONTEXT_CLICK() = 6` The user has performed a context click on an object. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#DRAG_START() = 25` The user has started a drag-and-drop gesture. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#FLAG_IGNORE_VIEW_SETTING() = 1` Flag for `https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat#performHapticFeedback(android.view.View,int,int)`: Ignore the setting in the view for whether to perform haptic feedback, do it always. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#GESTURE_END() = 13` The user has finished a gesture (e.g. on the soft keyboard). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#GESTURE_START() = 12` The user has started a gesture (e.g. on the soft keyboard). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#GESTURE_THRESHOLD_ACTIVATE() = 23` The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#GESTURE_THRESHOLD_DEACTIVATE() = 24` The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#KEYBOARD_PRESS() = 3` The user has pressed a virtual or software keyboard key. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#KEYBOARD_RELEASE() = 7` The user has released a virtual keyboard key. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#KEYBOARD_TAP() = 3` The user has pressed a soft keyboard key. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#LONG_PRESS() = 0` The user has performed a long press on an object that is resulting in an action being performed. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#NO_HAPTICS() = -1` No haptic feedback should be performed. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#REJECT() = 17` A haptic effect to signal the rejection or failure of a user interaction. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#SEGMENT_FREQUENT_TICK() = 27` The user is switching between a series of many potential choices, for example minutes on a clock face, or individual percentages. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#SEGMENT_TICK() = 26` The user is switching between a series of potential choices, for example items in a list or discrete points on a slider. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#TEXT_HANDLE_MOVE() = 9` The user has performed a selection/insertion handle move on text field. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#TOGGLE_OFF() = 22` The user has toggled a switch or button into the off position. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#TOGGLE_ON() = 21` The user has toggled a switch or button into the on position. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#VIRTUAL_KEY() = 1` The user has pressed on a virtual on-screen key. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#VIRTUAL_KEY_RELEASE() = 8` The user has released a virtual key. |

## Constants

### CLOCK_TICK

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val CLOCK_TICK = 4: Int
```

The user has pressed either an hour or minute tick of a Clock.

Compatibility:

- API \<21: No-op

### CONFIRM

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val CONFIRM = 16: Int
```

A haptic effect to signal the confirmation or successful completion of a user interaction.

Compatibility:

- API \<30: Same feedback as VIRTUAL_KEY

### CONTEXT_CLICK

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val CONTEXT_CLICK = 6: Int
```

The user has performed a context click on an object.

Compatibility:

- API \<23: Same feedback as CLOCK_TICK
- API \<21: No-op

### DRAG_START

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val DRAG_START = 25: Int
```

The user has started a drag-and-drop gesture. The drag target has just been "picked up".

Compatibility:

- API \<34: Same feedback as LONG_PRESS

### FLAG_IGNORE_VIEW_SETTING

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val FLAG_IGNORE_VIEW_SETTING = 1: Int
```

Flag for `https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat#performHapticFeedback(android.view.View,int,int)`: Ignore the setting in the view for whether to perform haptic feedback, do it always.

### GESTURE_END

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val GESTURE_END = 13: Int
```

The user has finished a gesture (e.g. on the soft keyboard).

Compatibility:

- API \<30: Same feedback as CONTEXT_CLICK
- API \<21: No-op

### GESTURE_START

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val GESTURE_START = 12: Int
```

The user has started a gesture (e.g. on the soft keyboard).

Compatibility:

- API \<30: Same feedback as VIRTUAL_KEY

### GESTURE_THRESHOLD_ACTIVATE

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val GESTURE_THRESHOLD_ACTIVATE = 23: Int
```

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold. This constant indicates that the user's motion has just passed the threshold for the action to be activated on release.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#GESTURE_THRESHOLD_DEACTIVATE()` | Compatibility: - API \<34: Same feedback as CONTEXT_CLICK - API \<21: No-op |

### GESTURE_THRESHOLD_DEACTIVATE

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val GESTURE_THRESHOLD_DEACTIVATE = 24: Int
```

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold. This constant indicates that the user's motion has just re-crossed back "under" the threshold for the action to be activated, meaning the gesture is currently in a cancelled state.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#GESTURE_THRESHOLD_ACTIVATE()` | Compatibility: - API \<34: Same feedback as CLOCK_TICK - API \<21: No-op |

### KEYBOARD_PRESS

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val KEYBOARD_PRESS = 3: Int
```

The user has pressed a virtual or software keyboard key.

Compatibility:

- API \<27: Same feedback as KEYBOARD_TAP

### KEYBOARD_RELEASE

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val KEYBOARD_RELEASE = 7: Int
```

The user has released a virtual keyboard key.

Compatibility:

- API \<27: No-op

### KEYBOARD_TAP

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val KEYBOARD_TAP = 3: Int
```

The user has pressed a soft keyboard key.

### LONG_PRESS

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val LONG_PRESS = 0: Int
```

The user has performed a long press on an object that is resulting in an action being performed.

### NO_HAPTICS

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val NO_HAPTICS = -1: Int
```

No haptic feedback should be performed. Applications may use this value to indicate skipping a call to `https://developer.android.com/reference/android/view/View.html#performHapticFeedback(android.os.vibrator.HapticFeedbackRequest)` entirely, or else rely that it will immediately return `false`.

Compatibility:

- API \<34: Same behavior, immediately returns false

### REJECT

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val REJECT = 17: Int
```

A haptic effect to signal the rejection or failure of a user interaction.

Compatibility:

- API \<30: Same feedback as LONG_PRESS

### SEGMENT_FREQUENT_TICK

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val SEGMENT_FREQUENT_TICK = 27: Int
```

The user is switching between a series of many potential choices, for example minutes on a clock face, or individual percentages. This constant is expected to be very soft, so as not to be uncomfortable when performed a lot in quick succession. If the device can't make a suitably soft vibration, then it may not make any vibration.

Some specializations of this constant exist for specific actions, notably `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#CLOCK_TICK()` and `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#TEXT_HANDLE_MOVE()`.

See also `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#SEGMENT_TICK()`.

Compatibility:

- API \<34: Same feedback as CLOCK_TICK
- API \<21: No-op

### SEGMENT_TICK

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val SEGMENT_TICK = 26: Int
```

The user is switching between a series of potential choices, for example items in a list or discrete points on a slider.

See also `https://developer.android.com/reference/kotlin/androidx/core/view/HapticFeedbackConstantsCompat#SEGMENT_FREQUENT_TICK()` for cases where density of choices is high, and the haptics should be lighter or suppressed for a better user experience.

Compatibility:

- API \<34: Same feedback as CONTEXT_CLICK
- API \<21: No-op

### TEXT_HANDLE_MOVE

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val TEXT_HANDLE_MOVE = 9: Int
```

The user has performed a selection/insertion handle move on text field.

Compatibility:

- API \<27: No-op

### TOGGLE_OFF

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val TOGGLE_OFF = 22: Int
```

The user has toggled a switch or button into the off position.

Compatibility:

- API \<34: Same feedback as CLOCK_TICK
- API \<21: No-op

### TOGGLE_ON

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val TOGGLE_ON = 21: Int
```

The user has toggled a switch or button into the on position.

Compatibility:

- API \<34: Same feedback as CONTEXT_CLICK
- API \<21: No-op

### VIRTUAL_KEY

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val VIRTUAL_KEY = 1: Int
```

The user has pressed on a virtual on-screen key.

### VIRTUAL_KEY_RELEASE

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
const val VIRTUAL_KEY_RELEASE = 8: Int
```

The user has released a virtual key.

Compatibility:

- API \<27: No-op