Created
November 5, 2013 17:09
-
-
Save cirocosta/7322456 to your computer and use it in GitHub Desktop.
registro gcm no background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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