Simplification

This commit is contained in:
M66B 2021-03-24 16:56:02 +01:00
parent a29402895d
commit 6aaac2b5b8
1 changed files with 2 additions and 5 deletions

View File

@ -24,10 +24,10 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.AlarmManagerCompat;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;
@ -462,10 +462,7 @@ public class EntityMessage implements Serializable {
am.cancel(pi); am.cancel(pi);
} else { } else {
Log.i("Set snooze id=" + id + " wakeup=" + new Date(wakeup)); Log.i("Set snooze id=" + id + " wakeup=" + new Date(wakeup));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) AlarmManagerCompat.setAndAllowWhileIdle(am, AlarmManager.RTC_WAKEUP, wakeup, pi);
am.set(AlarmManager.RTC_WAKEUP, wakeup, pi);
else
am.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, wakeup, pi);
} }
} }