WorkManager not repeating the PeriodicWorkRequest
Update your WorkManager version to 1.0.0-alpha04. You can check release notes here
Also, refer to this PeriodicWorkRequest GitHub demo and update TimeUnit as per your requirement in DayIncrementViewModel.java
. It will work as per your need.
WorkManager is still in alpha mode so it will work completely for all devices once they release the final version.
according to the documentation:
/**
* The minimum interval duration for {@link PeriodicWorkRequest} (in milliseconds).
*/
public static final long MIN_PERIODIC_INTERVAL_MILLIS = 15 * 60 * 1000L; // 15 minutes.
/**
* The minimum flex duration for {@link PeriodicWorkRequest} (in milliseconds).
*/
public static final long MIN_PERIODIC_FLEX_MILLIS = 5 * 60 * 1000L; // 5 minutes.
if you are setting this two value less than min specified, then you have to wait approx 20 min to see the log/output
If you use PeriodicWorkRequest with interval less than 15 min, you should return Result.retry()
, not success or failure.