appfeel / node-pushnotifications

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

APN contentAvailable (1) isn't compatible with GCM contentAvailable (true) #72

Closed calvinckho closed 6 years ago

calvinckho commented 6 years ago

In the JSON file, property contentAvailable for GCM and APN conflicts with each other. If you set contentAvailable to true, it works okay for GCM (which requires true) but does not work for APN (which requires 1).

alex-friedl commented 6 years ago

Fixed in https://github.com/appfeel/node-pushnotifications/pull/73

alex-friedl commented 6 years ago

Hello @calvinckho, thank you for your comment and PR!

Actually node-apn, does this conversion. See https://github.com/node-apn/node-apn/blob/aef8ec16e7449076f405982709cf72bdb3aa0b8a/lib/notification/apsProperties.js#L83

Do you experience issues with this? Because for me it works by setting the value to true

calvinckho commented 6 years ago

Great! Glad to know this. Maybe you can clarify it in the documentation? It is not very clear whether we should use 'true' or 1 for contentAvailable. Thanks!

contentAvailable: true, // gcm for android
delayWhileIdle: true, // gcm for android
restrictedPackageName: '', // gcm for android
...
action: '', // apn and gcm for ios
category: '', // apn and gcm for ios
contentAvailable: '', // apn and gcm for ios
alex-friedl commented 6 years ago

Hi @calvinckho . What do you think about https://github.com/appfeel/node-pushnotifications/pull/80/? Is it sufficiently clear in this form?

alex-friedl commented 6 years ago

Updated README in https://github.com/appfeel/node-pushnotifications/commit/fa64a98fc00717f6adfad74975d219ffe29fdc3e