MatthieuLemoine / push-receiver

A library to subscribe to GCM/FCM and receive notifications within a node process.
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
199 stars 75 forks source link

How to copy all the credentials from an Android device to our node server? #20

Open knissophiliac opened 5 years ago

knissophiliac commented 5 years ago

I have an another app(not my app) which is running on my phone, and this app's fcm server is sending notifications to my phone. I know the senderId and apiKey of the app and also my phone's pushNotificationId which is set by the app's server.

Can I get the notifications on my node server with this project? I thought I have to copy the credentials that created when the app opened first time and registered to the fcm server of the app to my nodejs push-receiver and start listening with those credentials.

Does it possible to get them from an Android device?

MatthieuLemoine commented 5 years ago

Seems like a great use case !

You'll need all the credentials required by push-receiver to listen to incoming notifications:

I never did that so I don't know how to retrieve these credentials 😕 The heavy part of the registration process is done by the OS not the application.

The registration logic we use in push-receiver was inspired by the registration process in Chrome. You may have to deep dive into Android source code to find what you want.

charlie-niekirk commented 4 years ago

All I had to do to receive FCM messages from my app (or another app I suppose) was to call register with my senderId which is in google-services.json. This worked like a treat for me.