Skip to content

Commit

Permalink
Use setWindow() for whileIdle alarm to.
Browse files Browse the repository at this point in the history
  • Loading branch information
ulezkin committed May 17, 2024
1 parent 53fdfa1 commit 8749301
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions flutter_local_notifications/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# [17.0.2+1]

* [Android] Use setWindow() for whileIdle alarm to.

# [17.0.2]

* [Android] Remove old corrupted notifications.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,17 @@ private static void setupAllowWhileIdleAlarm(
checkCanScheduleExactAlarms(alarmManager);
AlarmManagerCompat.setAlarmClock(alarmManager, epochMilli, pendingIntent, pendingIntent);
} else {
AlarmManagerCompat.setAndAllowWhileIdle(
alarmManager, AlarmManager.RTC_WAKEUP, epochMilli, pendingIntent);
if (notificationDetails.inexactWindowLengthMillis > 0L
&& VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
alarmManager.setWindow(
AlarmManager.RTC_WAKEUP,
epochMilli,
notificationDetails.inexactWindowLengthMillis,
pendingIntent);
} else {
AlarmManagerCompat.setAndAllowWhileIdle(
alarmManager, AlarmManager.RTC_WAKEUP, epochMilli, pendingIntent);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion flutter_local_notifications/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: flutter_local_notifications_plus
description: A cross platform plugin for displaying and scheduling local
notifications for Flutter applications with the ability to customise for each
platform.
version: 17.0.2
version: 17.0.2+1
homepage: https://github.com/Innim/flutter_local_notifications
repository: https://github.com/Innim/flutter_local_notifications
issue_tracker: https://github.com/Innim/flutter_local_notifications/issues
Expand Down

0 comments on commit 8749301

Please sign in to comment.