Interface ServicePluginBinding


public interface ServicePluginBinding
Binding that gives ServiceAware plugins access to an associated Service.
  • Method Details

    • getService

      @NonNull Service getService()
      Returns the Service that is currently attached to the FlutterEngine that owns this ServicePluginBinding.
    • getLifecycle

      @Nullable Object getLifecycle()
      Returns the 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.

    • addOnModeChangeListener

      void addOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener)
      Adds the given listener to be notified when the associated Service goes from background to foreground, or foreground to background.
    • removeOnModeChangeListener

      void removeOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener)
      Removes the given listener, which was previously added with addOnModeChangeListener(ServiceAware.OnModeChangeListener).