I have a react-native app which can receive push notifications with the react-native-gcm-android package. I want to play a sound (wether default or a custom) when I receive a push.
I tried some variations of my gcm payload, but none of the versions plays something:
dataPayload = {
'title': 'Stackoverflow',
'badge': 'Increment',
'alert': alert,
'notification': {
'subject': 'Stackoverflow',
'message': 'Some message',
'sound': 'default'
}
}
dataPayload = {
'title': 'Stackoverflow',
'badge': 'Increment',
'alert': 'Some text',
'notification': {
'subject': 'Stackoverflow',
'message': 'Some message',
'sound': 'android.resource://com.mypackagename.myapp/sound.mp3'
}
}
dataPayload = {
'title': 'Stackoverflow',
'badge': 'Increment',
'alert': 'Some text',
'notification': {
'subject': 'Stackoverflow',
'message': 'Some message',
'sound': true
}
}
The sound.mp3 file is located under android/app/src/res/