For the complete documentation index, see llms.txt. This page is also available as Markdown.

Haptic Sound Apis

Plays a custom sound alongside a haptic vibration effect, in one call.

Plays a custom sound — uploaded once via the WebToNative Dashboard — alongside a haptic vibration effect, in one call. Use this when an action should feel like a native alert and buzz at the same time (e.g. an order confirmation, an error state).

This is the sound-specific side of Haptics.trigger. For plain haptic feedback without a sound — the full effect reference and isHapticSupported — see Haptic Feedback.

Before calling this, upload the sound file via the Dashboard — see Uploading the Sound File on the OS Notification Sound page. Just want the sound alone, with no vibration? See Sound.play.

Platform support: Android and iOS.


JavaScript API Reference

Haptics.trigger accepts an optional soundName alongside effect, so one call triggers both.

window.WTN.Haptics.trigger({
  effect: "impactMedium",
  soundName: "your_sound_name",
});
import { trigger } from "webtonative/Haptics";

trigger({
  effect: "impactMedium",
  soundName: "your_sound_name",
});

Parameters:

Key
Type
Required
Description

effect

String

No

The vibration pattern to play. See supported values on the Haptic Feedback page.

soundName

String

No

Name of an uploaded sound file to play alongside the haptic effect, using the exact same lookup rules as Sound.play — omit it to trigger the haptic effect only.

Internally this plays the sound through the same path as Sound.play — there's no behavioral difference between calling Sound.play("x") directly versus passing soundName: "x" here, other than the haptic effect firing at the same time.


Common Patterns

Sound Alone vs. Sound + Haptic

Reserve the combined call for actions that warrant both signals — use Sound.play alone for higher-frequency events where a vibration on every occurrence would be excessive:


Troubleshooting

  • Sound doesn't play (haptic effect still fires): the sound lookup fails silently, same as Sound.play — double-check the file was uploaded to the correct platform's field on the Dashboard, that you've rebuilt/reinstalled since uploading, and that the name (and extension, if you passed one) matches exactly.