pub struct HapticFeedback;Expand description
Allows access to the haptic feedback interface on the device.
This API is intentionally terse since it calls default platform behavior. It is not suitable for precise control of the system’s haptic feedback module.
See also:
Implementations§
Source§impl HapticFeedback
impl HapticFeedback
Sourcepub fn vibrate(app: &App)
pub fn vibrate(app: &App)
Provides vibration haptic feedback to the user for a short duration.
On iOS devices that support haptic feedback, this uses the default system
vibration value (kSystemSoundID_Vibrate).
On Android, this uses the platform haptic feedback API to simulate a
response to a long press (HapticFeedbackConstants.LONG_PRESS).
Sourcepub fn light_impact(app: &App)
pub fn light_impact(app: &App)
Provides a haptic feedback corresponding a collision impact with a light mass.
On iOS versions 10 and above, this uses a UIImpactFeedbackGenerator with
UIImpactFeedbackStyleLight. This call has no effects on iOS versions
below 10.
On Android, this uses HapticFeedbackConstants.VIRTUAL_KEY.
See also:
Sourcepub fn medium_impact(app: &App)
pub fn medium_impact(app: &App)
Provides a haptic feedback corresponding a collision impact with a medium mass.
On iOS versions 10 and above, this uses a UIImpactFeedbackGenerator with
UIImpactFeedbackStyleMedium. This call has no effects on iOS versions
below 10.
On Android, this uses HapticFeedbackConstants.KEYBOARD_TAP.
Sourcepub fn heavy_impact(app: &App)
pub fn heavy_impact(app: &App)
Provides a haptic feedback corresponding a collision impact with a heavy mass.
On iOS versions 10 and above, this uses a UIImpactFeedbackGenerator with
UIImpactFeedbackStyleHeavy. This call has no effects on iOS versions
below 10.
On Android, this uses HapticFeedbackConstants.CONTEXT_CLICK on API levels
23 and above. This call has no effects on Android API levels below 23.
Sourcepub fn selection_click(app: &App)
pub fn selection_click(app: &App)
Provides a haptic feedback indication selection changing through discrete values.
On iOS versions 10 and above, this uses a UISelectionFeedbackGenerator.
This call has no effects on iOS versions below 10.
On Android, this uses HapticFeedbackConstants.CLOCK_TICK.
See also:
Sourcepub fn success_notification(app: &App)
pub fn success_notification(app: &App)
Provides a haptic feedback indicating that a task or action has completed successfully.
On iOS, this uses a UINotificationFeedbackGenerator with
UINotificationFeedbackTypeSuccess.
On Android, this uses HapticFeedbackConstants.CONFIRM on API levels 30
and above. This call has no effects on Android API levels below 30.
See also:
Sourcepub fn warning_notification(app: &App)
pub fn warning_notification(app: &App)
Provides a haptic feedback indicating that a task or action has produced a warning.
On iOS, this uses a UINotificationFeedbackGenerator with
UINotificationFeedbackTypeWarning.
On Android, this uses HapticFeedbackConstants.KEYBOARD_TAP on API
levels 30 and above. This call has no effects on Android API levels below
30.
Sourcepub fn error_notification(app: &App)
pub fn error_notification(app: &App)
Provides a haptic feedback indicating that a task or action has failed.
On iOS, this uses a UINotificationFeedbackGenerator with
UINotificationFeedbackTypeError.
On Android, this uses HapticFeedbackConstants.REJECT on API levels 30
and above. This call has no effects on Android API levels below 30.