public interface ServicePluginBinding
ServiceAware
plugins access to an associated Service
.Modifier and Type | Method and Description |
---|---|
void |
addOnModeChangeListener(ServiceAware.OnModeChangeListener listener)
Adds the given
listener to be notified when the associated Service goes from
background to foreground, or foreground to background. |
Object |
getLifecycle()
Returns the
Lifecycle associated with the attached Service . |
Service |
getService()
Returns the
Service that is currently attached to the FlutterEngine that owns
this ServicePluginBinding . |
void |
removeOnModeChangeListener(ServiceAware.OnModeChangeListener listener)
Removes the given
listener , which was previously added with #addOnModeChangeListener(OnModeChangeListener) . |
@NonNull Service getService()
Service
that is currently attached to the FlutterEngine
that owns
this ServicePluginBinding
.@Nullable Object getLifecycle()
Lifecycle
associated with the attached Service
.
Use the flutter_plugin_android_lifecycle plugin to turn the returned Object
into a
Lifecycle
object. See
(https://github.com/flutter/plugins/tree/master/packages/flutter_plugin_android_lifecycle).
Flutter plugins that rely on Lifecycle
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.
void addOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener)
listener
to be notified when the associated Service
goes from
background to foreground, or foreground to background.void removeOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener)
listener
, which was previously added with #addOnModeChangeListener(OnModeChangeListener)
.