Fix issue #342 - set as unique
This commit is contained in:
parent
9885aa2235
commit
6032870902
|
@ -27,6 +27,7 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.work.ExistingPeriodicWorkPolicy;
|
||||
import androidx.work.PeriodicWorkRequest;
|
||||
import androidx.work.WorkManager;
|
||||
|
||||
|
@ -43,6 +44,7 @@ import app.fedilab.android.jobs.NotificationsWorker;
|
|||
|
||||
public class PushHelper {
|
||||
|
||||
|
||||
public static void startStreaming(Context context) {
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
@ -113,7 +115,7 @@ public class PushHelper {
|
|||
PeriodicWorkRequest notificationPeriodic = new PeriodicWorkRequest.Builder(NotificationsWorker.class, Long.parseLong(value), TimeUnit.MINUTES)
|
||||
.addTag(Helper.WORKER_REFRESH_NOTIFICATION)
|
||||
.build();
|
||||
WorkManager.getInstance(context).enqueue(notificationPeriodic);
|
||||
WorkManager.getInstance(context).enqueueUniquePeriodicWork(Helper.WORKER_REFRESH_NOTIFICATION, ExistingPeriodicWorkPolicy.REPLACE, notificationPeriodic);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue