Interface ServiceControlSurface
-
public interface ServiceControlSurfaceControl surface through which aServiceattaches to aFlutterEngine.A
Servicethat contains aFlutterEngineshould coordinate itself with theFlutterEngine'sServiceControlSurface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidattachToService(Service service, androidx.lifecycle.Lifecycle lifecycle, boolean isForeground)Call this method from theServicethat is running theFlutterEnginethat is associated with thisServiceControlSurface.voiddetachFromService()Call this method from theServicethat is attached to thisServiceControlSurfaces'sFlutterEnginewhen theServiceis about to be destroyed.voidonMoveToBackground()Call this method from theServicethat is attached to thisServiceControlSurface'sFlutterEnginewhen theServicegoes from foreground to background.voidonMoveToForeground()Call this method from theServicethat is attached to thisServiceControlSurface'sFlutterEnginewhen theServicegoes from background to foreground.
-
-
-
Method Detail
-
attachToService
void attachToService(@NonNull Service service, @Nullable androidx.lifecycle.Lifecycle lifecycle, boolean isForeground)Call this method from theServicethat is running theFlutterEnginethat is associated with thisServiceControlSurface.Once a
Serviceis created, and its associatedFlutterEngineis executing Dart code, theServiceshould invoke this method. At that point theFlutterEngineis considered "attached" to theServiceand allServiceAwareplugins are given access to theService.isForegroundshould be true if the givenServiceis running in the foreground, false otherwise.
-
detachFromService
void detachFromService()
Call this method from theServicethat is attached to thisServiceControlSurfaces'sFlutterEnginewhen theServiceis about to be destroyed.This method gives each
ServiceAwareplugin an opportunity to clean up its references before theis destroyed.
-
onMoveToForeground
void onMoveToForeground()
Call this method from theServicethat is attached to thisServiceControlSurface'sFlutterEnginewhen theServicegoes from background to foreground.
-
onMoveToBackground
void onMoveToBackground()
Call this method from theServicethat is attached to thisServiceControlSurface'sFlutterEnginewhen theServicegoes from foreground to background.
-
-