user12256215
user12256215

Reputation:

My work manager is not working after kill the application

My android application doesn't run the workmanager when I killed the application. The workmanager stop working when the application process killed.

my code is :

PeriodicWorkRequest workRequest =
                new PeriodicWorkRequest.Builder(UploadWorker.class, 1, TimeUnit.MINUTES)
                        .setConstraints(constraints)
                        .build();
        WorkManager.getInstance().enqueue(workRequest);

and I have also applied Jobscheduler but the program is working when application still alive in the process. but when the application closed the workmanager is not working. I have set the periodic time is 1 min.

Upvotes: 2

Views: 4582

Answers (2)

Ehsan Razazian
Ehsan Razazian

Reputation: 1

The workmanager DOES NOT stop working when the application process killed, you set the period to 1 minute and minimum is 15 minute, so workmanager does the work you specified every 15 minute instead of 1 minute and ignore that 1 minute!

Upvotes: 0

raghu
raghu

Reputation: 841

The minimum interval for PeriodicWork is 15 minutes. Can you change the interval to 15 and check. Please check

https://medium.com/@yonatanvlevin/the-minimum-interval-for-periodicwork-is-15-minutes-same-as-jobscheduler-periodic-job-eb2d63716d1f

https://stackoverflow.com/a/51074388/2131915

Upvotes: 2

Related Questions