@@ -59,11 +59,21 @@ will not run in the same isolate as the main application. Unlike threads, isolat
5959memory and communication between isolates must be done via message passing (see more documentation on
6060isolates [ 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+
6265If 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+
6777In 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
93103thrown 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+
95116For help getting started with Flutter, view our online
96117[documentation](http://flutter.io/).
97118
0 commit comments