Fixed notification popping up every time update is scheduled

This commit is contained in:
Viktor De Pasquale 2019-05-25 16:33:55 +02:00
parent c33cf9f878
commit 1c90b6eca3

View File

@ -116,6 +116,8 @@ public class Utils {
if (Config.get(Config.Key.CHECK_UPDATES)) { if (Config.get(Config.Key.CHECK_UPDATES)) {
Constraints constraints = new Constraints.Builder() Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED) .setRequiredNetworkType(NetworkType.CONNECTED)
//ensures that notification doesn't pop up every time user starts the app
.setRequiresDeviceIdle(true)
.build(); .build();
Class<? extends ListenableWorker> service = (Class<? extends ListenableWorker>) ClassMap.get(UpdateCheckService.class); Class<? extends ListenableWorker> service = (Class<? extends ListenableWorker>) ClassMap.get(UpdateCheckService.class);
PeriodicWorkRequest request = new PeriodicWorkRequest PeriodicWorkRequest request = new PeriodicWorkRequest