android - Can I register a new app to existing GCM server? -
the app working on must implement push service. have alternative app developed using javascript , such , developed in parallel (different package name, etc). app has push implemented , server working. given server url , senderid used (based on guides):
instanceid instanceid = instanceid.getinstance(this); string token = instanceid.gettoken(serverrequests.senderid, googlecloudmessaging.instance_id_scope, null);
then used token register on server instructed. problem not receiving messages. there missed? work without having make modifications (highly unlikely) on server ?
check api-key valid using method here: https://developers.google.com/cloud-messaging/http
checking validity of api key if receive authentication errors when sending messages, check validity of api key. example, on android, run following command:
# api_key=your_api_key # curl --header "authorization: key=$api_key" \ --header content-type:"application/json" \ https://gcm-http.googleapis.com/gcm/send \ -d "{\"registration_ids\":[\"abc\"]}"
if receive 401 http status code, api key not valid. otherwise should see this:
{"multicast_id":6782339717028231855,"success":0,"failure":1, "canonical_ids":0,"results":[{"error":"invalidregistration"}]}
if want confirm validity of registration token, can replacing "abc" registration token.
Comments
Post a Comment