Closed akyoto closed 8 years ago
@blitzprog Could this be the case? I know you mentioned having only one API key and sender ID, but MismatchSenderId
is definitely a result of mixing up sender IDs and API keys.
I believe that MismatchSenderId means that you are trying to send push notifications using a GCM Server API Key that is linked to a different SENDER_ID than was used to generate some of your registration IDs on the client-side.
https://github.com/ToothlessGear/node-gcm/issues/162#issuecomment-145384668
I only have 1 sender ID (defined in manifest.json as gcm_sender_id and it's the project number). I also only use 1 server key. The push notifications using the very same site, same service worker, fail on Android Chrome registration tokens but work with Desktop Chrome generated tokens.
This may be a shot in the dark, but try creating a brand new project in the Google APIs Console, generating a new API key, and re-registering devices with the new SENDER_ID. (Project ID)
Ouch. That would invalidate all the device tokens currently registered, right? Well, I guess it can't be helped. Going to try it and let you know if it worked.
A little update: I'm sorry for naming the wrong error source. MismatchSenderId is completely irrelevant to the problem that the notification is not shown on Android. I noticed I had one excessive token in the database.
Now I have 2 "successful" messages but still only the desktop one actually appears on screen.
I created a completely new project with a new sender ID and new server key, it didn't have any effect. Desktop notification arrives, Android one doesn't.
I also tested manually triggering the "push" event on the device via chrome://serviceworker-internals/. The notification was shown correctly. That means my service worker code is not faulty.
The big question is: If node-gcm doesn't complain and the results are also labeled as "success" (I guess that's coming from Google servers) why is the push event itself not triggering?
@blitzprog If the results are labled "success" now, then it seems like GCM is consuming the push notification for your Android device and not issuing it correctly, either on purpose or due to a bug.
You can try manually issuing the GCM push request (using Postman for example) to isolate the cause and remove node-gcm
from the equation.
@eladnava: Thank you for the detailed help even though this seems to be a mistake on Google's side and not the node-gcm
package itself. I tried settings lots of things, played around with message options but in the end it just doesn't work on Android.
This guy has the same problem and it was written ~8 hours ago. http://stackoverflow.com/questions/34824859/success1-still-no-notification-in-android
I am assuming this is a bug in Google's server code so we can close this issue for now.
Interesting. Definitely looks like an issue on Google's side. Hope it gets resolved quickly!
Hey @blitzprog -- how are you developing your Android app? We have seen a lot of issues with development environments other than the Android SDK (like phonegap, etc). One problem has been lacking support for the notification
field.
It might just be Google's services being slow, though. They have no guarantee for delivery whatsoever, so notifications can be very delayed (or even dropped).
As I mentioned in the first post, it's not an Android app but a standard website which registers a service worker to receive push notifications.
The whole push workflow is working (I confirmed it by triggering the push event manually in the browser and it showed my notification). The problem is that the push event itself is not triggered in the service worker by GCM. I can't explain this behaviour, therefore I assume it must be a bug.
Additionally, Facebook's notifications also stopped working on my phone (Nexus 5) even though they worked on my phone in the past and they still work on Desktop.
Other devices are also affected because I asked some friends to test the push notifications with their phone and they confirmed that it doesn't work.
I've asked about this behaviour on the android-gcm Google Group but I haven't gotten a response yet: https://groups.google.com/forum/#!topic/android-gcm/wtHaMktu1qA
Have I understood it correctly if I understand it as an issue with Chrome on Android specifically?
@hypesystem I don't know how it works under the hood (whether it's a Chrome on Android bug or GCM on Android bug). I reckon I should ask on the chrome board as well.
I can't find anything on whether GCM notifications are supported on websites in Chrome on Android (only links talk about desktop Chrome as far as I can tell). Do you have any resources that indicate that Chrome on Android would be supported, too?
@hypesystem: I've linked it in the first post. It also shows a gif:
The Facebook notifications I was talking about: http://www.theverge.com/2015/9/15/9328915/chrome-facebook-push-notifications-android
Edit: I just tried the demo on my phone and it worked. Weird.
Ah, my bad, I didn't notice that original link.
It seems that your website is different from the example. We are entering territory where I am not well equipped to help you, but please keep us updated if you figure out what is wrong :smile:
Hi @hypesystem, I'm replying because you asked me to keep you up to date.
Firefox 44 was just released which has its own endpoint. I couldn't get it to work with node-gcm (overwriting uri).
I switched to web-push which was specifically made for my use case and the result is:
Sorry to say that I can't use your library. web-push
solved 2 problems at once for me.
Alright, glad you solved your issue :smile:
@eladnava this is a use case we have never worked at supporting, but it would be interesting to see if we could easily cover the use case that web-push covers, or if it is too different from normal notifications :smile:
@hypesystem as per the outcome of https://github.com/ToothlessGear/node-gcm/issues/205#issuecomment-178397812, this is something we will not be implementing as it is out of the scope of the package.
:+1:
Hi,
I'm using node-gcm for sending push notifications to users who add registrationTokens via the browser with service workers and those tokens are saved on a single server where the push notifications are being sent from. This server is whitelisted in the Google Project and uses a server API key.
On my desktop everything works fine. The notification arrives, everything perfect.
Now when I take my Android phone and "subscribe" (adding a new registration token) to notifications the subscription itself works flawlessly. I double-checked my database and it has 2 device tokens registered (Desktop + Android mobile phone). Now when I send a notification with 2 registration tokens using the .send() function this happens:
Notifications seem to never work on Android. I can't seem to figure out the reason for
MismatchSenderId
. I tried googling this error message but the solutions don't apply to me (my server key is correctly set up and my manifest.json includes the sender ID). Some solutions also say that a recompile and reinstall of the Android app worked for them, however, again this doesn't apply in my case because I'm not using an Android app. I'm registering/subscribing devices via the browser. Tried clearing all sorts of caches to see if that helps, no success.The message only includes a notification:
Including test data doesn't have any effect.
Any idea what's wrong here?