private void registerUser() throws IOException { String serverUrl = applicationContext.getSharedPreferences().getString(SERVER_URL_PREF, null); HttpResponse response = registerUserService.register(currentUser); if (response.getStatusLine().getStatusCode() == SC_OK) { currentUser.setServerUrl(serverUrl); } else { applicationContext.getSharedPreferences().edit().putString(SERVER_URL_PREF, "").commit(); } }
public List<String> getIdsToDownload() throws IOException, JSONException, HttpException { // Default value is currently epoch long lastUpdateMillis = context.getSharedPreferences().getLong(RapidFtrApplication.LAST_CHILD_SYNC, 0); DateTime lastUpdate = new DateTime(lastUpdateMillis); return childEntityHttpDao.getUpdatedResourceUrls(lastUpdate); }
@Override protected Application createApplication() { RapidFtrApplication application = new RapidFtrApplication(INJECTOR); try { application.getSharedPreferences().edit().putString(SERVER_URL_PREF, "http://1.2.3.4:5"); application.setFormSections(formSectionSeed); application.setCurrentUser(createUser()); } catch (Exception e) { throw new RuntimeException(e); } return application; }