From 6aaac2b5b8e616c83c25bd139de855d1bc531a92 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 24 Mar 2021 16:56:02 +0100 Subject: [PATCH] Simplification --- app/src/main/java/eu/faircode/email/EntityMessage.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityMessage.java b/app/src/main/java/eu/faircode/email/EntityMessage.java index bbe8110ab3..60118531ce 100644 --- a/app/src/main/java/eu/faircode/email/EntityMessage.java +++ b/app/src/main/java/eu/faircode/email/EntityMessage.java @@ -24,10 +24,10 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.os.Build; import android.text.TextUtils; import androidx.annotation.NonNull; +import androidx.core.app.AlarmManagerCompat; import androidx.preference.PreferenceManager; import androidx.room.ColumnInfo; import androidx.room.Entity; @@ -462,10 +462,7 @@ public class EntityMessage implements Serializable { am.cancel(pi); } else { Log.i("Set snooze id=" + id + " wakeup=" + new Date(wakeup)); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) - am.set(AlarmManager.RTC_WAKEUP, wakeup, pi); - else - am.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, wakeup, pi); + AlarmManagerCompat.setAndAllowWhileIdle(am, AlarmManager.RTC_WAKEUP, wakeup, pi); } }