Custom Sound Feature
Play your own uploaded sounds on demand from JavaScript, pair them with haptic feedback, and reuse them for push notifications across Android and iOS.
Lets your app play a custom sound — uploaded once via the WebToNative Dashboard — instead of relying only on the device's default sound. This page covers the shared prerequisite (uploading the file) and how the feature fits together; each way of actually playing the sound has its own dedicated page:
Sound.play
Play the uploaded sound immediately, triggered directly from your JavaScript.
Haptics.trigger
Play the uploaded sound alongside a haptic vibration effect, in one call.
Notification Sound
Have a remote push notification play the uploaded sound automatically when it arrives (via OneSignal or FCM).
You'll need to import the javascript file in your website before starting from this link.
Platform support: Android and iOS.
How It Works
One uploaded sound file can be used in all three places above, and all three reference it by the same name:
Sound.play(soundName)— plays it immediately from JavaScript (e.g. a chat "message sent" ping, a game effect). See Sound.play.Haptics.trigger({ effect, soundName })— plays it alongside a haptic vibration effect, in one call. See Haptic Feedback.A remote push notification — OneSignal or FCM tells the OS to play it automatically when a push arrives. See Notification Sound.
The sound file itself is never sent from your JavaScript or from a push payload — only its name is. It must already be uploaded to your app via the Dashboard (below) before you reference it from any of the three places above.
Uploading the Sound File (Dashboard)
Go to your WebToNative Dashboard → Add-ons → Notification → OS Notification Sound and upload the sound file under the platform's sound setting. Android and iOS each have their own separate upload field — uploading for one platform does not make the file available on the other, so upload the same audio to both fields if you want consistent behavior across platforms.
Reference name: the name you pass to
Sound.play/soundNameis derived from the uploaded file's name, minus its extension.Format: only
.mp3and.wavfiles can be uploaded — these are the only supported formats on both platforms.Extension:
.mp3is the default — if you callSound.play("your_sound_name")without an extension,.mp3is assumed automatically, so you don't need to pass anything if you uploaded an.mp3file. If you uploaded a.wavfile, you must pass the extension explicitly —Sound.play("your_sound_name.wav")— or the lookup will assume.mp3and fail to find it.
Changes take effect on your app's next build — if you're testing on a device already running an older build, rebuild/reinstall after uploading a new or changed sound file.