Skip to content

Instantly share code, notes, and snippets.

@tony1223
Created October 26, 2013 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tony1223/7173555 to your computer and use it in GitHub Desktop.
Save tony1223/7173555 to your computer and use it in GitHub Desktop.
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(_context);
new AsyncTask<GoogleCloudMessaging, Void, String>() {
@Override
protected String doInBackground(GoogleCloudMessaging... params) {
String msg = "";
try {
GoogleCloudMessaging message = params[0];
String regid = message.register(GOOGLE_SENDER_ID);
sendGCMIDToServer(regid);
} catch (IOException ex) {
msg = "Error :" + ex.getMessage();
}
return msg;
}
}.execute(gcm, null, null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment