@Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); if (action != null) { Importer importer = null; String path = ""; if (action.equals(ACTION_IMPORT_ADDRESSES)) { importer = new AddressImporter(this); path = ADDRESSES_PATH; } else if (action.equals(ACTION_IMPORT_HOSPITAL_ADMITTANCES)) { importer = new AdmittanceImporter(this); path = ADMITTANCES_PATH; } else if (action.equals(ACTION_IMPORT_DOCTOR_STANDBY)) { importer = new StandbyImporter(this); path = STANDBY_PATH; } if (importer != null) { importer.setOnPostProcessProgressListener( new Importer.OnPostProcessProgressListener() { @Override public void onProgress(double progressPercent) { reportProgress(progressPercent); } @Override public void onResult(String action, int processed, int modified) { reportResultPostProcess(action, processed, modified); } @Override public void onResult(String action, boolean result) { reportResultPostProcess(action, result); } }); startImport(path, importer); } } reportCompleted(intent.getAction()); DataImportReceiver.completeWakefulIntent(intent); }