public Task<Void> handleRegistrationIntentAsync(Intent intent){
  List<Task<Void>> tasks=new ArrayList<>();
  String registrationId=intent.getStringExtra(REGISTRATION_ID_EXTRA);
  if (registrationId != null && registrationId.length() > 0) {
    PLog.v(TAG,"Received deviceToken <" + registrationId + "> from GCM.");
    ParseInstallation installation=ParseInstallation.getCurrentInstallation();
    if (!registrationId.equals(installation.getDeviceToken())) {
      installation.setPushType(PushType.GCM);
      installation.setDeviceToken(registrationId);
      tasks.add(installation.saveInBackground());
    }
    tasks.add(updateLocalDeviceTokenLastModifiedAsync());
  }
synchronized (lock) {
    if (request != null) {
      request.onReceiveResponseIntent(intent);
    }
  }
  return Task.whenAll(tasks);
}

public Task < Void > handleRegistrationIntentAsync ( Intent intent ) { List < Task < Void > > tasks = new ArrayList < > ( ) ; String registrationId = intent . getStringExtra ( REGISTRATION_ID_EXTRA ) ; if ( registrationId != null && registrationId . length ( ) > 0 ) { PLog . v ( TAG , "Received deviceToken <" + registrationId + "> from GCM." ) ; ParseInstallation installation = ParseInstallation . getCurrentInstallation ( ) ; if ( ! registrationId . equals ( installation . getDeviceToken ( ) ) ) { installation . setPushType ( PushType . GCM ) ; installation . setDeviceToken ( registrationId ) ; tasks . add ( installation . saveInBackground ( ) ) ; } tasks . add ( updateLocalDeviceTokenLastModifiedAsync ( ) ) ; } synchronized ( lock ) { if ( request != null ) { request . onReceiveResponseIntent ( intent ) ; } } return Task . whenAll ( tasks ) ; }
should be called by a broadcast receiver or service to handle the gcm registration response intent ( com . google . android . c2dm . intent . registration ) .
