I implemented a GCM push notification service that runs on my computer (at least during development).
To do that, I basically format and send requests to https://android.googleapis.com/gcm/send
.
For authentication, I obviously used a server key I generated on the Google Developers console.
I tested it and it works perfectly (the devices receive the push notification, and it's actually damn fast).
I send those push notifications several times in the day, but yesterday I faced a situation were the request sending returned a 401
(which stands for authentication required). My request was exactly the same as usual. I retried 4 times with the same result then suddenly, it worked again and returned a 200
.
I'm at loss trying to understand why this happens. According to this documentation, 401
is only supposed to happen if:
- Authorization header missing or with invalid syntax.
- Invalid project number sent as key.
- Key valid but with GCM service disabled.
- Request originated from a server not whitelisted in the Server Key IPs.
None of these conditions have changed between the different calls.
Is there some kind of threshold or quota that might explain this ? Or is there a guideline regarding what to do when this happens ?