HapticFeedback

Cross-platform haptic feedback for mobile devices.

Group util

Declared in src/libs/libutil/util/HapticFeedback.hpp.

Detailed description

HapticFeedback provides static methods to trigger device vibrations on Android and iOS. Falls back to no-op on desktop platforms. Supports different feedback intensities for click, success, warning.

See also FeedbackType.

Member type documentation

FeedbackType enum

enum HapticFeedback::FeedbackType

This enum gives the kind of haptic event to play. On Android, each kind maps to a vibration length. On other platforms trigger() does nothing, whatever the kind.

Each constant is in HapticFeedback::FeedbackType.

Constant Value Description
Click 0 A light tap for a button press: 10 ms on Android.
Success 1 A positive confirmation: 30 ms on Android.
Warning 2 An alert or a warning: 50 ms on Android.
Selection 3 The lightest tap, for a change of selection: 5 ms on Android.
In this section