krunalpatel3 / WorkManager-Example-Andorid

How to use WorkManager in Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MyPeriodicWork is not running preodically

Rohitsachdeva opened this issue · comments

I have set time unit to Seconds

mPeriodicWorkRequest = new PeriodicWorkRequest.Builder(MyPeriodicWork.class,
                10, TimeUnit.SECONDS)
                .addTag("periodicWorkRequest")
                .build();

it is not running as expected

yes same error with me too i am running it on android PIE oneplus 5t the periodicworkmanger run first time when app open and then after 15 minuter no effect from background pls give us some running latest example pls

Try this:-

mPeriodicWorkRequest = new PeriodicWorkRequest.Builder(MyPeriodicWork.class,
18, TimeUnit.MINUTES)
.addTag("periodicWorkRequest")
.build();

Remember can not set PeriodicWork less than 15 MINUTES.

See this link here:- https://stackoverflow.com/questions/51202905/execute-task-every-second-using-work-manager-api