Interface ServicePluginBinding
public interface ServicePluginBinding
Binding that gives
ServiceAware
plugins access to an associated Service
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the givenlistener
to be notified when the associatedService
goes from background to foreground, or foreground to background.Returns theLifecycle
associated with the attachedService
.Returns theService
that is currently attached to theFlutterEngine
that owns thisServicePluginBinding
.void
Removes the givenlistener
, which was previously added withaddOnModeChangeListener(ServiceAware.OnModeChangeListener)
.
-
Method Details
-
getService
Returns theService
that is currently attached to theFlutterEngine
that owns thisServicePluginBinding
. -
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
Adds the givenlistener
to be notified when the associatedService
goes from background to foreground, or foreground to background. -
removeOnModeChangeListener
Removes the givenlistener
, which was previously added withaddOnModeChangeListener(ServiceAware.OnModeChangeListener)
.
-