Interface ServicePluginBinding
-
public interface ServicePluginBinding
Binding that givesServiceAware
plugins access to an associatedService
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addOnModeChangeListener(ServiceAware.OnModeChangeListener listener)
Adds the givenlistener
to be notified when the associatedService
goes from background to foreground, or foreground to background.Object
getLifecycle()
Returns theLifecycle
associated with the attachedService
.Service
getService()
Returns theService
that is currently attached to theFlutterEngine
that owns thisServicePluginBinding
.void
removeOnModeChangeListener(ServiceAware.OnModeChangeListener listener)
Removes the givenlistener
, which was previously added withaddOnModeChangeListener(ServiceAware.OnModeChangeListener)
.
-
-
-
Method Detail
-
getService
@NonNull Service getService()
Returns theService
that is currently attached to theFlutterEngine
that owns thisServicePluginBinding
.
-
getLifecycle
@Nullable Object getLifecycle()
Returns theLifecycle
associated with the attachedService
.Use the flutter_plugin_android_lifecycle plugin to turn the returned
Object
into aLifecycle
object. See (https://github.com/flutter/plugins/tree/master/packages/flutter_plugin_android_lifecycle). Flutter plugins that rely onLifecycle
are forced to use the flutter_plugin_android_lifecycle plugin so that the version of the Android Lifecycle library is exposed to pub, which allows Flutter to manage different versions library over time.
-
addOnModeChangeListener
void addOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener)
Adds the givenlistener
to be notified when the associatedService
goes from background to foreground, or foreground to background.
-
removeOnModeChangeListener
void removeOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener)
Removes the givenlistener
, which was previously added withaddOnModeChangeListener(ServiceAware.OnModeChangeListener)
.
-
-