Comments (5)
Hi, for iOS the system sound should work, in the docs there's an example setting the sound using a ringtone name (https://notifee.app/react-native/docs/ios/behaviour#sound). It may be the case that we only support ringtone sounds and not alert tones which is what those sounds in your screenshot are. But it could be a possible feature enhancement we can support.
As of Android, I'll get back to you on that one. I don't think we currently support system sounds (https://notifee.app/react-native/docs/android/behaviour#sound) but there might be a way we can use the url returned from the library.
from notifee.
Hi, I've taken a look at Android, and you can set the sound on the channel to the content url the library gives you (see doc update: https://notifee.app/react-native/docs/android/behaviour#device-sound)
For example:
await notifee.createChannel({
id: "custom-sound",
name: "Customer Sound",
sound: soundsList[2].url,
});
await notifee.displayNotification({
...
android: {
channelId: "custom-sound",
},
});
from notifee.
Update on iOS sounds, there was an issue with the docs. As it stands, the sound has to be inside your app bundle for iOS to play the sound. See https://developer.apple.com/documentation/usernotifications/unnotificationsound?language=objc
There may be a workaround where we can play the system sound at the same time the notification is displayed, this will need some testing to make sure the sound plays at the same time the notification is displayed. But, this will only work for notifications shown via displayNotification
and trigger notifications :(
from notifee.
Closing as the question has been answered above.
from notifee.
Hi, I've taken a look at Android, and you can set the sound on the channel to the content url the library gives you (see doc update: https://notifee.app/react-native/docs/android/behaviour#device-sound) For example:
await notifee.createChannel({ id: "custom-sound", name: "Customer Sound", sound: soundsList[2].url, }); await notifee.displayNotification({ ... android: { channelId: "custom-sound", }, });
This worked for android with s3 URLs
For iOS I am using '@react-native-community/audio-toolkit' package in the background and playing sound before displaying the notification.
import { Player } from '@react-native-community/audio-toolkit';
const sound = new Player(soundFile.file_path);
sound.play();
await notifee.displayNotification(notifeeObj);
from notifee.
Related Issues (20)
- Feature Request/Enhancement - Interval trigger with custom timestamp HOT 3
- React Native: Issue with Daily Triggered Notifications Not Firing Properly HOT 1
- NullPointerException: Attempt to invoke virtual method 'void android.view.View.dispatchCancelPendingInputEvents() HOT 1
- Notification type, Property 'ab_cat' does not exist on type HOT 1
- 26-second mp3 file when used for "sound" property in trigger is played by iOS 17 only for 5 seconds HOT 1
- [Android] Handle onBackgroundEvent navigation and API call HOT 2
- [Android] Small Icon not working correctly in release build HOT 1
- Add image message support in Android MessagingStyle
- Getting only one notification even I send multiple messages. HOT 1
- Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available. HOT 6
- onBackgroundEvent no longer works in App.js HOT 1
- [iOS] onBackgroundEvent EventType Press, Dismissed or Delivered doesn't work HOT 2
- New architecture support?
- Foreground service freezes when app dismissed
- Android Build Failure When Locking Dependencies `Could not resolve app.notifee:core:+.`
- Add in additional code examples for onBackgroundEffect
- Notifee does not support extra params from Android intent back to JS
- [Android] onForegroundEvent doesn't work with React-native 0.74.5 ( sdk target 34) HOT 1
- onBackgroundEvent not working with Trigger notifications
- iOS: Quick actions not working when app is killed due to onBackgroundEvent() not triggering
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from notifee.