Use appropriate AlarmManager methods for different API levels
This commit is contained in:
parent
dd854d0243
commit
d77d80e39e
@ -6,6 +6,7 @@ import android.app.PendingIntent;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
@ -595,7 +596,13 @@ public class Departure implements Parcelable, Comparable<Departure> {
|
|||||||
|
|
||||||
long alarmTime = getAlarmClockTime();
|
long alarmTime = getAlarmClockTime();
|
||||||
|
|
||||||
alarmManager.set(AlarmManager.RTC_WAKEUP, alarmTime, alarmIntent);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, alarmTime, alarmIntent);
|
||||||
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
alarmManager.setExact(AlarmManager.RTC_WAKEUP, alarmTime, alarmIntent);
|
||||||
|
} else {
|
||||||
|
alarmManager.set(AlarmManager.RTC_WAKEUP, alarmTime, alarmIntent);
|
||||||
|
}
|
||||||
|
|
||||||
if (Log.isLoggable(Constants.TAG, Log.VERBOSE))
|
if (Log.isLoggable(Constants.TAG, Log.VERBOSE))
|
||||||
Log.v(Constants.TAG,
|
Log.v(Constants.TAG,
|
||||||
|
Loading…
Reference in New Issue
Block a user