I am trying to add sound to my local push notification. I am using RN 0.45.1 and react-native-push-notifications 3.0.0
I manage to schedule notification in iOS and Android with default sound. I did not manage to add custom sound.
I have sounds file of type mp3. I tried the following:
- place the file in my project folder: '/src/assests/sounds/sound.mps' (a folder inside my project)
and than:
import notificationSound from '../src/assests/sounds/sound.mps';
PushNotification.localNotificationSchedule({
message: 'Test message',
date: new Date(Date.now() + (60 * 1000)),
repeatType: 'time',
repeatTime: 60 * 1000,
sound: notificationSound,
});
- another attempt was: putting the sound file under android folder: ..\android\app\src\main\res\raw\sound.mp3
and the notification was:
PushNotification.localNotificationSchedule({
message: 'Test message',
date: new Date(Date.now() + (60 * 1000)),
repeatType: 'time',
repeatTime: 60 * 1000,
sound: sound.mp3,
});