Skip to content

Instantly share code, notes, and snippets.

@cirocosta
Created November 5, 2013 17:09
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 cirocosta/7322456 to your computer and use it in GitHub Desktop.
Save cirocosta/7322456 to your computer and use it in GitHub Desktop.
registro gcm no background
private void registerInBackground(){
new AsyncTask<Void,Void,String>(){
@Override
protected String doInBackground(Void... arg0){
String msg = "";
try{
if(gcm == null){
gcm = GoogleCloudMessaging.getInstance(context);
}
regid = gcm.register(SENDER_ID);
msg = "Registred:" + regid;
if(sendRegistrationIdToBackend(regid)){
storeRegistrationId(context,regid);
}
} catch (IOException ex){
ex.printStackTrace();
}
return msg;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment