appfeel / node-pushnotifications

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
544 stars 125 forks source link

Android High priority on silent push. #170

Closed roberto-lem closed 2 years ago

roberto-lem commented 2 years ago

Hey, Seems to be impossible sending a high priority push to an Android device if silent is set to true. Is this the intended behavior? I came across this line but I'm not sure why it's needed. https://github.com/appfeel/node-pushnotifications/blob/72056a0b6fe1c287ca172f12d9d621e41b7b8a6c/src/sendGCM.js#L137

alex-friedl commented 2 years ago

@roberto-lem Thanks for reporting this. The line you highlighted has been adapted to its current form in https://github.com/appfeel/node-pushnotifications/pull/144. I read through the discussion in the PR again but neither there nor in the Firebase docs I can find any indication that data-only notifications need to be normal priority? Could you adapt this line by removing the || data.silent check and test if that modified version works for your purpose?

roberto-lem commented 2 years ago

Hey @alex-friedl, Thanks for your response. We made the change and were able to get high priority silent push notifications on Android. Would you want me to open a PR?

alex-friedl commented 2 years ago

@roberto-lem That would be awesome! Thank you very much :)

roberto-lem commented 2 years ago

@alex-friedl Sorry, seems like I don't have permissions to push my branch, could you grant me or just do the change yourself? It's just changing the line to this: priority: data.priority === 'normal' ? 'normal' : 'high',

alex-friedl commented 2 years ago

@roberto-lem Released with https://github.com/appfeel/node-pushnotifications/releases/tag/2.0.1