-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Updated android_alarm_manager
to work after engine refactor.
#642
Conversation
Depends on engine PR #5640. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Fixes issue #17566: alarm_manager plugin stopped working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkonyi I think we're missing the invocation of the result callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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