2

I was implementing the Work Manager.As per documentation, work manager will give the guarantee to execute your task. But When i am using in OREO and swiping out the application from recent apps then work manager is not working. It will be a great help if anyone can suggest me what i am doing the wrong.

PeriodicWorkRequest.Builder photoWorkBuilder =
            new PeriodicWorkRequest.Builder(SchedulePullApiWorker.class, 15,
                    TimeUnit.MINUTES);
    PeriodicWorkRequest myWork = photoWorkBuilder
            .build();
    WorkManager.getInstance().enqueue(myWork);

Here is my worker class

public class SchedulePullApiWorker extends Worker {


public SchedulePullApiWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);

}

@NonNull
@Override
public Result doWork() {
    showNotification();
    return Result.success();
}

Gradle :

implementation "android.arch.work:work-runtime:1.0.0-rc02"
implementation "android.arch.work:work-rxjava2:1.0.0-rc02"
Shubham Chauhan
  • 929
  • 2
  • 7
  • 18

0 Answers0