Skip to content

Instantly share code, notes, and snippets.

@cirocosta
Last active December 27, 2015 11:59
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/7322260 to your computer and use it in GitHub Desktop.
Save cirocosta/7322260 to your computer and use it in GitHub Desktop.
BAsic Implem MainActivity
@Override
protected void onCreate(Bundle savedInstanceState){
//...
if(checkPlayServices()){
gcm = GoogleCloudMessaging.getInstance(this);
registration_id = getRegistrationId(context);
if(registration_id.equals("")){
registerInBackground();
} else {
// não foi encontrato APK Google Play Services
}
}
private String getRegistrationId(Context context){
//Obtem REGID já obtido ...
regid = preferences.getString("key","default");
if(nao_tem_regid){
return "";
}
return regid;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment