Reputation: 37
We currently face a strange issue when testing the GCM Service.
When we are sending a valid request (with a valid registration_id) then everything is fine and the notification is sent to the client app.
Then we wanted to test a kind of negative scenario, where we used a wrong registration_id (we just exchanged one letter) and then GCM returns 400 BAD REQUEST or 401 UNAUTHORIZED.
Based on the GCM Documentation we should get a "200+error:InvalidRegistration".
Edit 1: We only use the "to" and "content_available" fields in the request to GCM. JSON is fine, else it would not work with a valid registration_id.
Edit 2: We found out that if you change a letter of the registration id manually, you will receive a Bad Request as response. This means that there might be some validations on GCM side to check if a registration_id is manipulated. If we use a registration_id from another app, we receive normal error responses from GCM.
Did anyone face this issue before?
Upvotes: 2
Views: 1029
Reputation: 4250
Yes, you are right.
But;
If you send only one token with 'to' parameter, GCM returns 400.
if you try to send multiple tokens(some of them is valid and others not), GCM returns 200 and error list has 'InvalidRegistration' code.
As this scenario, I can say;
if use 'to', GCM returns 400.
if use 'registration_ids', GCM returns 200 and error list in response.
You can also check it with this library's test cases.
Upvotes: 2