only works with v2 Android embedding (Flutter 1.12.x+)
gets whether the foreground service should continue running after the app is killed
for instance when it's swiped off of the recent apps list
default behavior is true = keep service running after app killed
get the execution period for the service function (get/setServiceFunction);
period is "minimum/best-effort" - will try to space executions with an interval that's at least this long
only works with v2 Android embedding (Flutter 1.12.x+)
sets whether the foreground service should continue running after the app is killed
for instance when it's swiped off of the recent apps list
default behavior = true = keep service running after app killed
by default, the service function is async, and will be invoked on a timer
if you want to wait for the previous function execution to finish
before invoking it again, set this to false (default is true)
it will also wait until the serviceInterval has elapsed
ex:
interval = 5 seconds; instance1 required execution time = 9 seconds;
instance2 required execution time = 2 seconds
set the execution period for the service function (get/setServiceFunction)
period is "minimum/best-effort" - will try to space executions with an interval that's at least this long
when sendToPort(message) is called in one isolate,
messageHandler(message) will be invoked from the other isolate
i.e. main_sendToPort -> background_messageHandler and vice-versa
serviceFunction needs to be self-contained
i.e. all setup/init/etc. needs to be done entirely within serviceFunction
since apparently due to how the implementation works
callback is done within a new isolate, so memory is not shared
(static variables will not have the same values, etc. etc.)
communication of simple values between serviceFunction and the main app
can be accomplished using setupIsolateCommunication & sendToPort