mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 18:15:49 +01:00
/ Only execute setAlarmViaAlarmManager when we are running Lollipop+.
This commit is contained in:
parent
6e7abecb17
commit
7651c080c2
@ -84,7 +84,9 @@ public class SleepAlarmWidget extends AppWidgetProvider {
|
|||||||
GBAlarm alarm = new GBAlarm(0, true, true, Alarm.ALARM_ONCE, hours, minutes);
|
GBAlarm alarm = new GBAlarm(0, true, true, Alarm.ALARM_ONCE, hours, minutes);
|
||||||
alarm.store();
|
alarm.store();
|
||||||
|
|
||||||
setAlarmViaAlarmManager(context, calendar.getTimeInMillis());
|
if (GBApplication.isRunningLollipopOrLater()) {
|
||||||
|
setAlarmViaAlarmManager(context, calendar.getTimeInMillis());
|
||||||
|
}
|
||||||
|
|
||||||
GB.toast(context,
|
GB.toast(context,
|
||||||
String.format(context.getString(R.string.appwidget_alarms_set), hours, minutes),
|
String.format(context.getString(R.string.appwidget_alarms_set), hours, minutes),
|
||||||
@ -96,9 +98,9 @@ public class SleepAlarmWidget extends AppWidgetProvider {
|
|||||||
* Use the Android alarm manager to create the alarm icon in the status bar.
|
* Use the Android alarm manager to create the alarm icon in the status bar.
|
||||||
*
|
*
|
||||||
* @param packageContext {@code Context}: A Context of the application package implementing this
|
* @param packageContext {@code Context}: A Context of the application package implementing this
|
||||||
* class.
|
* class.
|
||||||
* @param triggerTime {@code long}: time at which the underlying alarm is triggered in wall time
|
* @param triggerTime {@code long}: time at which the underlying alarm is triggered in wall time
|
||||||
* milliseconds since the epoch
|
* milliseconds since the epoch
|
||||||
*/
|
*/
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
private void setAlarmViaAlarmManager(Context packageContext, long triggerTime) {
|
private void setAlarmViaAlarmManager(Context packageContext, long triggerTime) {
|
||||||
|
Loading…
Reference in New Issue
Block a user