Skip to content

when sending push notification for android, I got MismatchSenderId error #704

Description

@jiawenzhang

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

-[ ] You've met the prerequisites.

-[ ] You're running the latest version of Parse Server.

-[ ] You've searched through existing issues. Chances are that your issue has been reported or resolved before.

Environment Setup

Steps to reproduce

Logs/Trace

Activity

  1. changed the title [-]when enabling push notification for android, do we need two different gcm keys? for for server and one for client. It is not clear in the document.[/-] [+]when enabling push notification for android, do we need two different sender id and api key? for for server and one for client. It is not clear in the document.[/+] on Feb 27, 2016
  2. jiawenzhang commented on Feb 27, 2016

    @jiawenzhang
    Author

    I have created GCM credentials and enabled Google Cloud Messaging in google cloud platform. I also added the push senderId and apiKey in Parse Server's index.js

    var api = new ParseServer({
    .
    .
    .
    push: {
          android: {
              senderId: 'Project number',
              apiKey: 'XXXXXXXX'
          }
        }
    });
    

    when I test sending push using the following REST api call:

    curl -X POST \
             -H "X-Parse-Application-Id: myAppId" \
             -H "X-Parse-Master-Key: foo" \
             -H "Content-Type: application/json" \
             -d '{
                 "where": {
                     "deviceType": {
                         "$in": [
                             "android"
                             ]
                     }
                 },
                     "data": {
                     }
             }' \
    https://fast-badlands-XXXXX.herokuapp.com/parse/push
    

    I saw this log:

    GCM request and response {"request":{"params":{"priority":"normal","data":{"time":"2016-02-27T22:19:17.914Z","push_id":"PASML5ShpI","data":"{\"friendRequestUpdate\":0}"}}},"response":{"multicast_id":5176387894691562000,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}}

    why does it return MismatchSenderId error?

  3. changed the title [-]when enabling push notification for android, do we need two different sender id and api key? for for server and one for client. It is not clear in the document.[/-] [+]when sending push notification for android, I got MismatchSenderId error[/+] on Feb 27, 2016
  4. gfosco commented on Feb 28, 2016

    @gfosco
    Contributor

    Was this an installation migrated from parse.com? Is that the senderId which was used to register this device?

  5. jiawenzhang commented on Feb 28, 2016

    @jiawenzhang
    Author

    How will installation affect REST api call from command line? In my test, there are no installations migrated from parse.com. When I delete all the installations on mongodb and run the test push command, server logs shows the same error of MismatchSenderId.

    It also logs Can not find sender for push type ios, {"where":{"deviceType":{"$in":["android"]}},"data":{}}
    But I think it is unrelated as I didn't specify iOS push in index.js

  6. jiawenzhang commented on Feb 28, 2016

    @jiawenzhang
    Author

    Odd! I tested again and now push is successfully received. Nothing has changed in my code. I suspect something fishy was going on in GCM

  7. jiawenzhang commented on Feb 28, 2016

    @jiawenzhang
    Author

    I found the problem, I put

     <meta-data android:name="com.parse.push.gcm_sender_id"
                    android:value="id:xxxxxxxxx" />
    

    outside the application section in the AndroidManifest. The app still compiles and runs but I guess the sender_id is not used from the client?

    When I move it to inside application, push works.

    @gfosco Thanks.

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

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions