Skip to content

Commit fbdf805

Browse files
bkonyiEgor
authored andcommitted
[ android_alarm_manager ] Loosen Flutter SDK lower bound, update README (flutter#2338)
1 parent 746a576 commit fbdf805

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

packages/android_alarm_manager/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.4.5+1
2+
3+
* Loosen Flutter version restriction to 1.9.1. **NOTE: plugin registration
4+
for the background isolate will not work correctly for applications using the
5+
V2 Flutter Android embedding for Flutter versions lower than 1.12.**
6+
17
## 0.4.5
28

39
* Add support for Flutter Android embedding V2

packages/android_alarm_manager/README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,21 @@ will not run in the same isolate as the main application. Unlike threads, isolat
5959
memory and communication between isolates must be done via message passing (see more documentation on
6060
isolates [here](https://api.dart.dev/stable/2.0.0/dart-isolate/dart-isolate-library.html)).
6161

62+
63+
## Using other plugins in alarm callbacks
64+
6265
If alarm callbacks will need access to other Flutter plugins, including the
63-
alarm manager plugin itself, it is necessary to teach the background service how
64-
to initialize plugins. This is done by giving the `AlarmService` a callback to call
65-
in the application's `onCreate` method. See the example's
66+
alarm manager plugin itself, it may be necessary to inform the background service how
67+
to initialize plugins depending on which Flutter Android embedding the application is
68+
using.
69+
70+
### Flutter Android Embedding V1
71+
72+
For the Flutter Android Embedding V1, the background service must be provided a
73+
callback to register plugins with the background isolate. This is done by giving
74+
the `AlarmService` a callback to call the application's `onCreate` method. See the example's
6675
[Application overrides](https://github.com/flutter/plugins/blob/master/packages/android_alarm_manager/example/android/app/src/main/java/io/flutter/plugins/androidalarmmanagerexample/Application.java).
76+
6777
In particular, its `Application` class is as follows:
6878

6979
```java
@@ -92,6 +102,17 @@ Which must be reflected in the application's `AndroidManifest.xml`. E.g.:
92102
**Note:** Not calling `AlarmService.setPluginRegistrant` will result in an exception being
93103
thrown when an alarm eventually fires.
94104

105+
### Flutter Android Embedding V2 (Flutter Version >= 1.12)
106+
107+
For the Flutter Android Embedding V2, plugins are registered with the background
108+
isolate via reflection so `AlarmService.setPluginRegistrant` does not need to be
109+
called.
110+
111+
**NOTE: this plugin is not completely compatible with the V2 embedding on
112+
Flutter versions < 1.12 as the background isolate will not automatically
113+
register plugins. This can be resolved by running `flutter upgrade` to upgrade
114+
to the latest Flutter version.**
115+
95116
For help getting started with Flutter, view our online
96117
[documentation](http://flutter.io/).
97118

packages/android_alarm_manager/pubspec.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: android_alarm_manager
22
description: Flutter plugin for accessing the Android AlarmManager service, and
33
running Dart code in the background when alarms fire.
4-
version: 0.4.5
4+
version: 0.4.5+1
55
author: Flutter Team <[email protected]>
66
homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager
77

@@ -22,5 +22,4 @@ flutter:
2222

2323
environment:
2424
sdk: ">=2.0.0-dev.28.0 <3.0.0"
25-
# TODO(bkonyi): set minimum Flutter version to next stable release
26-
flutter: ">=1.2.0 <2.0.0"
25+
flutter: ">=1.9.1 <2.0.0"

0 commit comments

Comments
 (0)