Skip to content

FCM adapter #32

Closed
Closed

Description

@thailey01

How would we go about developing a push adapter for FCM. Projects created in Google Console seem to now be required to use Firebase Cloud Messaging instead of GCM. I've tried to start an FCM adapter by copying the GCM adapter where I could but I'm changing certain parts when needed based on fcm-node documentation.

Activity

  1. flovilmart commented on Sep 4, 2016

    @flovilmart
    Contributor

    We could add a new handler here for fcm, so it processes properly fcm based push alongside GCM. The FCM compatible installations will have pushType set to fcm instead of gcm. What do you think?

  2. thailey01 commented on Sep 4, 2016

    @thailey01
    Author

    That'd be perfect! Wish I could help in some way.

  3. flovilmart commented on Sep 7, 2016

    @flovilmart
    Contributor

    No need for the FCM adapter, just initialize with the right key and the GCM adapter pushes will automagically send everything correctly!

  4. thailey01 commented on Sep 7, 2016

    @thailey01
    Author

    Don't you need a serverapi key and a project number? I don't think firebase supplies the project number or key.

  5. thailey01 commented on Sep 7, 2016

    @thailey01
    Author

    Nevermind, Firebase creates a senderId and Server Api Key which can be found in the project settings.

  6. thailey01 commented on Sep 8, 2016

    @thailey01
    Author

    Do we still have to add firebase to our projects? I set the senderId and apiKey found in Firebase but the message wasn't pushed.

  7. flovilmart commented on Sep 8, 2016

    @flovilmart
    Contributor

    Does the token was acquired with the firebase SDK? Not sure about the compatibility here

  8. thailey01 commented on Sep 8, 2016

    @thailey01
    Author

    When setting up fcm, the Firebase console automatically creates a senderId and a serverApiKey.

  9. flovilmart commented on Sep 8, 2016

    @flovilmart
    Contributor

    I means the android device tokens. Maybe we should still let gcm and fcm token live separately.

  10. thailey01 commented on Sep 8, 2016

    @thailey01
    Author

    Oh, I haven't added the Firebase sdk to my app so the token must be generated by parse. Basically, I'm running parse-server as usual but have setup fcm (which created a serverkey and senderId). I'm then placing that key and id in parse-server just like I would with gcm key and id. Sorry for the confusion.

  11. flovilmart commented on Sep 8, 2016

    @flovilmart
    Contributor

    All device tokens acquired with GCM should work with FCM. But if you changed your senderID and serverKey, that's likely to be problematic IMHO yet I'm not sure

  12. thailey01 commented on Sep 8, 2016

    @thailey01
    Author

    The thing is I haven't setup gcm with parse-server. I was using push through hosted parse but it didn't require me to create an app for gcm. Now the only option we have is to add fcm instead of gcm and it doesn't seem to be working. I setup my parse app (and server side) just like how you would with gcm and added the fcm credentials to it, which is really only the server key but that shouldn't be any different.

  13. flovilmart commented on Sep 8, 2016

    @flovilmart
    Contributor

    @inlined may have more input on that.

  14. 23 remaining items

  15. flovilmart commented on Oct 28, 2016

    @flovilmart
    Contributor

    As you mention, the current adapter works with FCM, just the notification field is missing.
    Do you want to make a pull request to support that?

  16. felimartina commented on Oct 28, 2016

    @felimartina

    But without notification field nothing is displayed on the Android device. What's the point of having notifications working but not having them displayed on the screen?
    I pulled and compiled fcm-adapter branch and seems to be working fine if you set the device's pushType equal to fcm (also need to add fcm to parse push notifications). Not sure how stable the fcm-adapter branch is though.

  17. flovilmart commented on Oct 28, 2016

    @flovilmart
    Contributor

    There is no need to use the fcm branch, the master branch should work correctly with fcm

  18. felimartina commented on Oct 28, 2016

    @felimartina

    Mhhh...could you explain me a bit further? If I use master branch, what do I need to change on the Android App (or in my server when requesting a push notification) in order to get Push Notifications DISPLAYED on the phone screen?
    This is how I am requesting the push notification and it is not being displayed on the Android screen. Am I missing something?:

    curl -X POST \
      -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
      -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
            "where" : {
            "user" : {
                "__type" : "Pointer",
                "className" : "_User",
                "objectId" : "RKGGWkXaIh"
            }
        },
            "data" : {
            "body" : "great match!",
            "title" : "Portugal vs. Denmark",
            "alert": "something to say"
        }
          }' \
      http://localhost:4040/parse/push
    

    FYI...I am using parse-server-push-adapter from npm (1.1.0). Is that the very same version that holds the master branch?

  19. felimartina commented on Oct 28, 2016

    @felimartina

    That is what I mean.
    Let me re-phrase. How do I do in order to DISPLAY a notification on an Android phone?

  20. flovilmart commented on Oct 28, 2016

    @flovilmart
    Contributor

    One need to open a pull request, follow the examples from the node-gcm package and implement the notification key inside the GCM payload.

  21. felimartina commented on Oct 28, 2016

    @felimartina

    Okay, Just like someone did in the fcm-adapter. The thing is that there is no such feature in parse then, correct? There is no way, currently, to display android notifications in the phone screen using parse-server.

    BTW...thank you so much for your quick responses @flovilmart and for helping me to troubleshoot this

  22. flovilmart commented on Oct 28, 2016

    @flovilmart
    Contributor

    I believe this is a change in the google API's and we didn't catch it up. Because you caught it, that would be nice if you provide the fix too.

  23. felimartina commented on Oct 28, 2016

    @felimartina

    Awesome! It just feels weird I am the only one seeing this issue (thought multiple people are using parse for sending push notifications).
    I will try to put something together to overcome this problem. But I am only seeing this problem when using fcm setttigs and the gcm sender from parse.
    I will try to create a pull request (need to catch up on the repo rules first)...
    I see the fcm-adapter is doing kind of the same here. Any other thought on your side @flovilmart ?

    Again, thanks for everything

  24. flovilmart commented on Oct 28, 2016

    @flovilmart
    Contributor

    The fcm branch is abandoned and should be deleted, as I thought that fcm was not compatible with the node-gcm package. You can get some inspiration from there definitely.

  25. mmazzarolo commented on Oct 28, 2016

    @mmazzarolo
    Contributor

    thought multiple people are using parse for sending push notifications

    @felimartina I had the same issue but I thought it was just a mis-configuration on my side

  26. felimartina commented on Oct 28, 2016

    @felimartina

    @mmazzarolo will see if I grab some spare time these days and create a pull request...should be as simple as taking into account notification field when sending the GCM in the GCM.js file. Let me know if you are experiencing some other issue we can see if we can add support for other options that can be sent to Android phones.
    These are the fields supported in the gmc/fmc payload:

    https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support

  27. mmazzarolo commented on Nov 2, 2016

    @mmazzarolo
    Contributor
  28. jamlfy commented on May 18, 2017

    @jamlfy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions