private void addInFailed(String filename) { Context applicationContext = getApplicationContext(); InternetHelper internetHelper = InternetHelper.getInstance(applicationContext); DAOHelper instance = DAOHelper.getInstance(applicationContext); boolean wifiOnly = instance.getWifiOnlyState(); if (internetHelper.canUpload(wifiOnly)) { synchronized (failedUploadsList) { if (!failedUploadsList.contains(filename)) { failedUploadsList.add(filename); } } } }
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.w(LOG_TAG, "service started"); Context context = getApplicationContext(); if (internetHelper == null) { internetHelper = InternetHelper.getInstance(context); } if (daoHelper == null) { daoHelper = DAOHelper.getInstance(context); } if (awsUploadHelper == null) { awsUploadHelper = new AWSUploadHelper(context); } synchronized (failedUploadsList) { failedUploadsList.clear(); } return super.onStartCommand(intent, flags, startId); }