Loading app/src/main/java/foundation/e/drive/work/FullScanWorker.java 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * Copyright © Vincent Bourgmayer (/e/ foundation). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.drive.work; import android.content.Context; import android.content.Intent; import android.util.Log; import androidx.annotation.NonNull; import androidx.work.Worker; import androidx.work.WorkerParameters; import foundation.e.drive.services.ObserverService; /** * As a first step, this class must replace foundation.e.drive.jobs.ScannerJob * in order to allow to use Jetpack Work API * * In further development it will be a part of Workers that will replace ObserverService * I will update this header accordingly * * @author Vincent Bourgmayer */ public class FullScanWorker extends Worker { final private static String TAG = FullScanWorker.class.getSimpleName(); public FullScanWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { super(context, workerParams); } @NonNull @Override public Result doWork() { Log.d(TAG, "doWork(): going to send intent to ObserverService"); Intent observerServiceIntent = new Intent(this.getApplicationContext(), ObserverService.class); this.getApplicationContext().startService(observerServiceIntent); return Result.success(); } } Loading
app/src/main/java/foundation/e/drive/work/FullScanWorker.java 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * Copyright © Vincent Bourgmayer (/e/ foundation). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.drive.work; import android.content.Context; import android.content.Intent; import android.util.Log; import androidx.annotation.NonNull; import androidx.work.Worker; import androidx.work.WorkerParameters; import foundation.e.drive.services.ObserverService; /** * As a first step, this class must replace foundation.e.drive.jobs.ScannerJob * in order to allow to use Jetpack Work API * * In further development it will be a part of Workers that will replace ObserverService * I will update this header accordingly * * @author Vincent Bourgmayer */ public class FullScanWorker extends Worker { final private static String TAG = FullScanWorker.class.getSimpleName(); public FullScanWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { super(context, workerParams); } @NonNull @Override public Result doWork() { Log.d(TAG, "doWork(): going to send intent to ObserverService"); Intent observerServiceIntent = new Intent(this.getApplicationContext(), ObserverService.class); this.getApplicationContext().startService(observerServiceIntent); return Result.success(); } }