Skip to main content
The Haptics plugin lets you trigger haptic vibration effects used to provide feedback to end users based on various events and actions within your app. Support is provided for six different haptic effects that have been specifically designed to be comparable across iOS and Android devices. The plugin also provides support for the “shake” gesture such that a JavaScript callback is invoked when the user shakes their device.

Why use haptics

  • Cross-platform consistency: Six haptic styles have been specifically designed to be comparable across iOS and Android devices, so your feedback patterns work uniformly regardless of platform.
  • Rich haptic vocabulary: Choose from impact and notification styles to match the intensity and meaning of each interaction in your app.
  • Android-exclusive styles: Three additional Android-only styles (tick, click, double_click) give you extra expressiveness on Android devices.
  • Shake gesture support: Respond to physical device shake events with a JavaScript callback, enabling shake-to-action patterns without additional native code.

Prerequisites

  • A Median app with the JavaScript Bridge enabled
  • The Haptics plugin enabled under Native Plugins in Median App Studio
  • A physical iOS or Android device for testing (haptics do not deliver meaningful feedback in a virtual simulator environment)

Implementation guide

App setup

  1. Navigate to Native Plugins: In App Studio, go to Native Plugins.
  2. Enable Haptics: Toggle the Haptics plugin to enabled status. The plugin can also be trialed.
Haptics plugin in the Native Plugins list in App Studio

Haptics plugin enablement

JavaScript Bridge implementation

Trigger haptic vibration event

Triggers a haptic vibration effect on the user’s device. Pass a style string to specify which effect to fire.
style is a string parameter that can be any of the following options: iOS and Android
  • impactLight
  • impactMedium
  • impactHeavy
  • notificationSuccess
  • notificationWarning
  • notificationError
Android only
  • tick
  • click
  • double_click

Respond to shake gesture

Add the median_device_shake() JavaScript function to all pages that should provide a response to the shake gesture. You can also insert this function using the custom JavaScript feature. For example:

Testing checklist

Use this checklist to ensure Haptics is working correctly in your app:
  • Each style value triggers a distinct haptic effect on a physical device
  • median_device_shake is invoked when the device is shaken
  • Haptic feedback intensity matches the action’s visual and semantic weight
  • Plugin does not interfere with app navigation or core web flows
  • All haptic behavior is verified on a physical device, not a simulator

Frequently asked questions

This is expected behavior. Haptics will not deliver meaningful feedback in a virtual simulator environment. Test on a physical iOS or Android device to verify haptic behavior.
The tick, click, and double_click styles are supported on Android only. If you are testing on an iOS device, these styles will have no effect. Verify you are testing on a physical Android device.
Confirm that the median_device_shake() function is defined on the current page. You can add it globally using the custom JavaScript feature. Ensure the function name matches exactly: median_device_shake.
Last modified on December 3, 2026