Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jiawenzhang opened this issue Feb 27, 2016 · 5 comments
Closed
Labels
type:question Support or code-level question

Comments

@jiawenzhang
Copy link

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

@jiawenzhang jiawenzhang 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. Feb 27, 2016
@jiawenzhang
Copy link
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?

@jiawenzhang jiawenzhang 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 Feb 27, 2016
@gfosco
Copy link
Contributor

gfosco commented Feb 28, 2016

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

@jiawenzhang
Copy link
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

@jiawenzhang
Copy link
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

@jiawenzhang
Copy link
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
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants