question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Notification Sound Not Playing

See original GitHub issue

Bug

Environment info

react-native info output:

System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Memory: 84.60 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.12.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 15, 23, 24, 26, 27, 28, 29
      Build Tools: 22.0.1, 24.0.1, 27.0.3, 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.13.1 => 16.13.1
    react-native: 0.62.2 => 0.62.2
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native: 0.61.4

Library version: 3.4.0

Steps To Reproduce

  1. Put sound.mp3 in iOS Resources/ folder
  2. Call PushNotification.localNotification

Describe what you expected to happen:

I received the notification, but no sound is played. I expected the notification to play my custom sound sound.mp3.

Reproducible sample code

PushNotification.localNotification({
      autoCancel: true,
      smallIcon: 'ic_stat',
      subText: 'Notification',
      color: appColors.accent,
      vibrate: true,
      title: message.data.title,
      message: message.data?.message,
      soundName: 'sound.mp3',
});

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
daheeahncommented, Jul 14, 2020

remove .mp3 (‘sound.mp3’ to ‘sound’) then it works!!!

0reactions
sacru2redcommented, May 11, 2022

I didnt know channelId rules use only alphabet(lowercase), number and hyphen character

Read more comments on GitHub >

github_iconTop Results From Across the Web

A reason why custom notification sound might not work on ...
First of all, we should remove the notification channel and create a new one with a new notification channel id. Secondly, we should...
Read more >
Top 10 Ways to Fix Notification Sound Not Working on Android
1. Check Notification Volume · 2. Enable Sound Profile · 3. Turn off DND · 4. Check Notification Sound Settings for Apps ·...
Read more >
Windows 10 Pro will not play custom notification sound
My WAV sound file is fine, I can click it and Groove music or Windows media player will play it just fine. Through...
Read more >
custom notification sound not play… | Apple Developer Forums
Our app uses custom notifications sounds which have been working fine when the app is open and when closed or in background mode....
Read more >
Custom Notification Sound not working in Android Oreo
To set a sound to notifications in Oreo, you must set sound on NotificationChannel and not on Notification Builder itself.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found