public void onStart() { super.onStart(); if (App42GCMController.isPlayServiceAvailable(this)) { App42GCMController.getRegistrationId(MainActivity.this, GoogleProjectNo); } else { Log.i("App42PushNotification", "No valid Google Play Services APK found."); } }
/** * @param context * @param googleProjectNo * @param callBack */ @SuppressLint("NewApi") public static void getRegistrationId( Context context, String googleProjectNo, App42GCMListener callBack) { GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String regid = App42GCMController.getRegistrationId(context); if (regid.isEmpty()) { registeronGCM(context, googleProjectNo, gcm, callBack); } else callBack.onGCMRegistrationId(regid); }