private void updateClient(final String registrationId) { try { logger.info( String.format( "Updating client... (applicationId: %d, token: %s, environment: %s)", applicationId, registrationId, environment)); GrowthPush.this.client.setToken(registrationId); GrowthPush.this.client.setEnvironment(environment); GrowthPush.this.client = GrowthPush.this.client.update(); logger.info( String.format("Update client success (clientId: %d)", GrowthPush.this.client.getId())); Preference.getInstance().saveClient(GrowthPush.this.client); latch.countDown(); } catch (GrowthPushException e) { logger.error(String.format("Updating client fail. %s", e.getMessage())); } }
private void createClient(final String registrationId) { try { logger.info( String.format( "Registering client... (applicationId: %d, environment: %s)", applicationId, environment)); GrowthPush.this.client = new Client(registrationId, environment).save(GrowthPush.this); logger.info( String.format( "Registering client success (clientId: %d)", GrowthPush.this.client.getId())); logger.info( String.format( "See https://growthpush.com/applications/%d/clients to check the client registration.", applicationId)); Preference.getInstance().saveClient(GrowthPush.this.client); latch.countDown(); } catch (GrowthPushException e) { logger.error(String.format("Registering client fail. %s", e.getMessage())); } }