Updated android_alarm_manager to work after engine refactor.#642
Updated android_alarm_manager to work after engine refactor.#642
android_alarm_manager to work after engine refactor.#642Conversation
|
Depends on engine PR #5640. |
Fixes issue #17566: alarm_manager plugin stopped working
zanderso
left a comment
There was a problem hiding this comment.
lgtm w/ more comments since this example will teach others how to write these plugins for Android.
| const String _backgroundName = | ||
| 'plugins.flutter.io/android_alarm_manager_background'; | ||
|
|
||
| void _alarmManagerCallbackDispatcher() { |
There was a problem hiding this comment.
Add a comment that this is the entrypoint for the background isolate
| sStarted.set(true); | ||
| } | ||
|
|
||
| public static void startAlarmService(Context context, long callbackHandle) { |
There was a problem hiding this comment.
Some comments about what is going on here will probably be helpful to 3p developers trying to write their own plugins.
...alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AlarmService.java
Show resolved
Hide resolved
|
Hello @bkonyi , Some hints regarding documentation at: https://pub.dartlang.org/packages/android_alarm_manager
thanks a lot again for landing this feature into flutter. this plugin api probably could be used for ios implementation too using ios background.fetch mode. i am not an ios developer, but based on flutter/flutter#3671 (comment) it is doable and already functioning in reactnative and nativescript. |
| startService((JSONArray) arguments); | ||
| result.success(true); | ||
| } else if (method.equals("AlarmService.initialized")) { | ||
| AlarmService.onInitialized(); |
There was a problem hiding this comment.
@bkonyi I think we're missing the invocation of the result callback?
There was a problem hiding this comment.
Yeah, looks like it. I don't think it causes any problems though, does it? I don't believe the background isolate cares if it gets a response here.
There was a problem hiding this comment.
I'm just going through the fun task of auditing all of our invokeMethod calls as part of reviewing #1365 and was confused when looking at this.
I'm guessing it will result in the future here never completing:
https://github.com/flutter/flutter/blob/ecfdd7e1ea96be3c762af6a1bd6be63d9e4d9682/packages/flutter/lib/src/services/platform_channel.dart#L295
Probably best to clean it up anyway.
Fixes issue #17566: alarm_manager plugin stopped working