问题
I'm trying to send Push Notifications via C2DM / GCM to an Android Application via PHP. No matter which i use, i keep getting the following :
For GCM : {"multicast_id":7672049265453358197,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
For C2DM : Error=InvalidRegistration
After reading allot about this issue all day I'm still clueless as to why this is an InvalidRegistration as if i take the registatoin_id and use it to send a test push message via Urban Airship it works.
- Notice that this is not an auth issue as i get a [http_code] => 200 back from google and not 401.
- If i send an empty registatoin_id or even omit just one char from it the error message changes to "MissingRegistration".
Any help would be appreciated.
回答1:
If you copied the apid
from UrbanAirship then that's the problem:
http://docs.urbanairship.com/reference/glossary.html#term-apid
Airship Push Identifier
APID
APIDs identify devices with transient registration IDs, such as Windows devices. These identifiers are version 4 UUIDs, and are 36 characters long, including dashes.
You need to get the device information from http://docs.urbanairship.com/api/ua.html#get--api-apids-(APID) in the "gcm_registration_id"
property. That's the registration id needed.
It seems you need to then keep track of that registration id as it is transient as suggested by UrbanAirship. But that's another topic.
来源:https://stackoverflow.com/questions/26104839/invalidregistration-both-on-c2dm-gcm