setup
Sets up the wake manager. PeriodicWork uses a repeat interval and a flex interval _____before flex_____|_____flex_____... ___cannot run work___|_can run work_... \____________________________________/\____________________________________/... interval 1 interval 2 ...(repeat) Details: Execution of the WorkManager can occur "randomly" in part B of the first interval and anytime in part B of the second interval, etc. We set the flex to the minimum value to reduce the variance in when the PeriodicWork runs. With the Flex set to 5 minutes and repeat interval set to 15 minutes (minimum values), this means that. At worst, execution can occur at the start of Interval 1 Part B and the end of Interval 2 Part B ==> 20 minutes At best, execution can occur at the end of interval 1 Part B and the start of interval 1 Part B ==> 10 minutes Hence, the worker will wake up sometime between 10 and 20 minutes. As such, we set the last_active "pulse" update to 5 minutes (previously it was 10 minutes) This ensures that no matter when the work manager fires, if the application has been killed, it will restart. Therefore, the application should restart itself in, at worst, 25 minutes.