public interface ServiceControlSurface
Modifier and Type | Method and Description |
---|---|
void |
attachToService(Service service,
androidx.lifecycle.Lifecycle lifecycle,
boolean isForeground)
Call this method from the
Service that is running the FlutterEngine that is
associated with this ServiceControlSurface . |
void |
detachFromService()
|
void |
onMoveToBackground()
|
void |
onMoveToForeground()
|
void attachToService(@NonNull Service service, @Nullable androidx.lifecycle.Lifecycle lifecycle, boolean isForeground)
Service
that is running the FlutterEngine
that is
associated with this ServiceControlSurface
.
Once a Service
is created, and its associated FlutterEngine
is executing
Dart code, the Service
should invoke this method. At that point the FlutterEngine
is considered "attached" to the Service
and all ServiceAware
plugins are given access to the Service
.
isForeground
should be true if the given Service
is running in the
foreground, false otherwise.
void detachFromService()
Service
that is attached to this ServiceControlSurfaces
's FlutterEngine
when the Service
is about to be
destroyed.
This method gives each ServiceAware
plugin an opportunity to clean up its references
before the is destroyed
.
void onMoveToForeground()
void onMoveToBackground()