appfeel / node-pushnotifications

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

Android GCM Weird behavior v1.6.2 #157

Open DowsingUK opened 3 years ago

DowsingUK commented 3 years ago

Hi there I'm developing an app using Java I'm using your package and when I use these settings everything works I even get silent push notifications in my Android devices I don't know why they're in silent mode I'm even using silent: false but I keep getting silent notifications I have tried every combination of settings and nothing else seems to work and then if I use this or this I just get "error":"InternalServerError" after call ****

*gcm: { id: config.fcm_server_id, phonegap: true }

**gcm: { id: config.fcm_server_id, phonegap: false }

***gcm: { id: config.fcm_server_id }

****push.send(registrationIds, data).then(function(result) { log(result); //This prints this info here not in catch function so I'm guessing something's wrong in your side "method": "gcm", "multicastId": [ xxxxxxxxxxxxxxxxxx ], "success": 0, "failure": 1, "message": [ { ... "error": "InternalServerError" } ]

}) .catch(function(err) { log(err); //never gets call });

alex-friedl commented 3 years ago

@DowsingUK Hard to tell why you get silent notifications from the information you provided. Can you share a more complete example if your notification payload?

DowsingUK commented 3 years ago

I'm using same code as the example:

const settings = { gcm: { id: fcm_server_id, phonegap: true, // if false fails, if true works in silent mode }, };

push = new PushNotifications(settings);

const data = { title: hook.data.title, // REQUIRED for Android // topic: 'topic', // REQUIRED for iOS (apn and gcm) /* The topic of the notification. When using token-based authentication, specify the bundle ID of the app.

alex-friedl commented 3 years ago

Do you need phonegap compatibility mode? Have you tried phonegap: false ? If phonegap=true the notification property will be set to undefined, which can result in a silent notification if you also don't set a sound or icon.

alex-friedl commented 3 years ago

Also you posted basically the example with empty default values but it's not clear which payload you specify in the body. I would assume your payload is incomplete. Please refer to https://github.com/ToothlessGear/node-gcm to see some example configurations for your Android use-case

DowsingUK commented 3 years ago

I've been using the same payload in a previous version 1.4.1 and everything works fine I'm actually using that version in production right now it's a stable one at least in my case just looking forward to update if you help me with this bug. I do not need phonegap mode actually the first thing I tried was disabling it with not positive outcome as I describe in the main post I have use phonegap: true and that's making every push notification a silent one if I remove phonegap property or set it to false I get "error": "InternalServerError"

alex-friedl commented 3 years ago

Would be interesting to get more details of InternalServerError response from Firebase. Any chance you can debug this on your end with some breakpoints or logs in your local node-gcm dependency? Or is there the possibility to get more details from the Firebase console?

alex-friedl commented 2 years ago

@DowsingUK Any update on this? Do you still experience these issues?

DowsingUK commented 2 years ago

Same issues with this package, push works fine if I send push from FCM console