-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receive sound and color from JSON payload #225
Conversation
Sound and color should be passed from the [JSON payload](https://developers.google.com/cloud-messaging/http-server-ref#notification-payload-support) to the notification listener.
@jgarber I think this feature is already present in the current implementation. I am not using |
@varungupta85 I'm afraid not. Put in a few logging statements and try it yourself. JSON payload: {"channels": ["rtAvn8ayx3y"], "color": "#FF0000", "sound": "alarm.wav", "data": {"title": "Test title", "alert": "Your alarm is sounding", "color": "#FF0000", "sound": "alarm.wav"}} adb logcat:
...but thank you so much @varungupta85 for adding sounds! You got me 99% of the way there! 👏 |
...In which case there might be other things you want to collect from the payload. I just needed sound and color was easy too. Feel free to address it differently! |
The project I'm using this on has Parse Server on the backend. With sound in the data hash and this patch for Android, the alarm sound works properly on both platforms through Parse's push notifications. |
This project already supports sound and colour. It sounds like the parse backend isn't sending the data in the correct shape maybe? The solution is to send a silent notification that contains a payload, and then have your app send a local-notification in the JS code that puts an alert in the notification centre. With local-notifications you can control sound, vibrate, color, different text sizes - you have much more control over the ui basically. |
@the Parse backed is sending data in the correct shape for iOS and I just assumed it should be the same for Android since RN is all about cross platform as much as possible. But if you say that's not how it's supposed to work, that's fine--feel free to close this PR. I don't think it does any harm, but on the other hand, I've been an OSS maintainer who accepted too much and got the project loaded up with everybody's crap. 😁 Thanks for setting giving me some direction on the proper implementation! |
I agree actually - this project already synthesises a local notification from a data payload, so all this does is add to that functionality |
Sound and color should be passed from the JSON payload to the notification listener.