Interface ServiceControlSurface
-
public interface ServiceControlSurface
Control surface through which aService
attaches to aFlutterEngine
.A
Service
that contains aFlutterEngine
should coordinate itself with theFlutterEngine
'sServiceControlSurface
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
attachToService(Service service, androidx.lifecycle.Lifecycle lifecycle, boolean isForeground)
Call this method from theService
that is running theFlutterEngine
that is associated with thisServiceControlSurface
.void
detachFromService()
Call this method from theService
that is attached to thisServiceControlSurfaces
'sFlutterEngine
when theService
is about to be destroyed.void
onMoveToBackground()
Call this method from theService
that is attached to thisServiceControlSurface
'sFlutterEngine
when theService
goes from foreground to background.void
onMoveToForeground()
Call this method from theService
that is attached to thisServiceControlSurface
'sFlutterEngine
when theService
goes from background to foreground.
-
-
-
Method Detail
-
attachToService
void attachToService(@NonNull Service service, @Nullable androidx.lifecycle.Lifecycle lifecycle, boolean isForeground)
Call this method from theService
that is running theFlutterEngine
that is associated with thisServiceControlSurface
.Once a
Service
is created, and its associatedFlutterEngine
is executing Dart code, theService
should invoke this method. At that point theFlutterEngine
is considered "attached" to theService
and allServiceAware
plugins are given access to theService
.isForeground
should be true if the givenService
is running in the foreground, false otherwise.
-
detachFromService
void detachFromService()
Call this method from theService
that is attached to thisServiceControlSurfaces
'sFlutterEngine
when theService
is about to be destroyed.This method gives each
ServiceAware
plugin an opportunity to clean up its references before theis destroyed
.
-
onMoveToForeground
void onMoveToForeground()
Call this method from theService
that is attached to thisServiceControlSurface
'sFlutterEngine
when theService
goes from background to foreground.
-
onMoveToBackground
void onMoveToBackground()
Call this method from theService
that is attached to thisServiceControlSurface
'sFlutterEngine
when theService
goes from foreground to background.
-
-