Package io.flutter.embedding.engine.plugins.activity

## Interface ActivityPluginBinding

-     public interface ActivityPluginBinding

  Binding that gives `ActivityAware` plugins access to an associated `Activity` and the `Activity`'s lifecycle methods.

  To obtain an instance of an `ActivityPluginBinding` in a Flutter plugin, implement the `ActivityAware` interface. A binding is provided in `ActivityAware.onAttachedToActivity(ActivityPluginBinding)` and `ActivityAware.onReattachedToActivityForConfigChanges(ActivityPluginBinding)`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `ActivityPluginBinding.OnSaveInstanceStateListener` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addActivityResultListener​(PluginRegistry.ActivityResultListener listener)` | Adds a listener that is invoked whenever the associated `Activity`'s `onActivityResult(...)` method is invoked.
    `void` | `addOnNewIntentListener​(PluginRegistry.NewIntentListener listener)` | Adds a listener that is invoked whenever the associated `Activity`'s `onNewIntent(...)` method is invoked.
    `void` | `addOnSaveStateListener​(ActivityPluginBinding.OnSaveInstanceStateListener listener)` | Adds a listener that is invoked when the associated `Activity` or `Fragment` saves and restores instance state.
    `void` | `addOnUserLeaveHintListener​(PluginRegistry.UserLeaveHintListener listener)` | Adds a listener that is invoked whenever the associated `Activity`'s `onUserLeaveHint()` method is invoked.
    `void` | `addRequestPermissionsResultListener​(PluginRegistry.RequestPermissionsResultListener listener)` | Adds a listener that is invoked whenever the associated `Activity`'s `onRequestPermissionsResult(...)` method is invoked.
    `Activity` | `getActivity()` | Returns the `Activity` that is currently attached to the `FlutterEngine` that owns this `ActivityPluginBinding`.
    `Object` | `getLifecycle()` | Returns the `Lifecycle` associated with the attached `Activity`.
    `void` | `removeActivityResultListener​(PluginRegistry.ActivityResultListener listener)` | Removes a listener that was added in `addActivityResultListener(PluginRegistry.ActivityResultListener)`.
    `void` | `removeOnNewIntentListener​(PluginRegistry.NewIntentListener listener)` | Removes a listener that was added in `addOnNewIntentListener(PluginRegistry.NewIntentListener)`.
    `void` | `removeOnSaveStateListener​(ActivityPluginBinding.OnSaveInstanceStateListener listener)` | Removes a listener that was added in `addOnSaveStateListener(OnSaveInstanceStateListener)`.
    `void` | `removeOnUserLeaveHintListener​(PluginRegistry.UserLeaveHintListener listener)` | Removes a listener that was added in `addOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener)`.
    `void` | `removeRequestPermissionsResultListener​(PluginRegistry.RequestPermissionsResultListener listener)` | Removes a listener that was added in `addRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener)`.

- - ### Method Detail

    - #### getActivity

          @NonNull
          Activity getActivity()

      Returns the `Activity` that is currently attached to the `FlutterEngine` that owns this `ActivityPluginBinding`.

    - #### getLifecycle

          @NonNull
          Object getLifecycle()

      Returns the `Lifecycle` associated with the attached `Activity`.

      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.

    - #### addRequestPermissionsResultListener

          void addRequestPermissionsResultListener​(@NonNull
                                                   PluginRegistry.RequestPermissionsResultListener listener)

      Adds a listener that is invoked whenever the associated `Activity`'s `onRequestPermissionsResult(...)` method is invoked.

    - #### removeRequestPermissionsResultListener

          void removeRequestPermissionsResultListener​(@NonNull
                                                      PluginRegistry.RequestPermissionsResultListener listener)

      Removes a listener that was added in `addRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener)`.

    - #### addActivityResultListener

          void addActivityResultListener​(@NonNull
                                         PluginRegistry.ActivityResultListener listener)

      Adds a listener that is invoked whenever the associated `Activity`'s `onActivityResult(...)` method is invoked.

    - #### removeActivityResultListener

          void removeActivityResultListener​(@NonNull
                                            PluginRegistry.ActivityResultListener listener)

      Removes a listener that was added in `addActivityResultListener(PluginRegistry.ActivityResultListener)`.

    - #### addOnNewIntentListener

          void addOnNewIntentListener​(@NonNull
                                      PluginRegistry.NewIntentListener listener)

      Adds a listener that is invoked whenever the associated `Activity`'s `onNewIntent(...)` method is invoked.

    - #### removeOnNewIntentListener

          void removeOnNewIntentListener​(@NonNull
                                         PluginRegistry.NewIntentListener listener)

      Removes a listener that was added in `addOnNewIntentListener(PluginRegistry.NewIntentListener)`.

    - #### addOnUserLeaveHintListener

          void addOnUserLeaveHintListener​(@NonNull
                                          PluginRegistry.UserLeaveHintListener listener)

      Adds a listener that is invoked whenever the associated `Activity`'s `onUserLeaveHint()` method is invoked.

    - #### removeOnUserLeaveHintListener

          void removeOnUserLeaveHintListener​(@NonNull
                                             PluginRegistry.UserLeaveHintListener listener)

      Removes a listener that was added in `addOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener)`.

    - #### addOnSaveStateListener

          void addOnSaveStateListener​(@NonNull
                                      ActivityPluginBinding.OnSaveInstanceStateListener listener)

      Adds a listener that is invoked when the associated `Activity` or `Fragment` saves and restores instance state.

    - #### removeOnSaveStateListener

          void removeOnSaveStateListener​(@NonNull
                                         ActivityPluginBinding.OnSaveInstanceStateListener listener)

      Removes a listener that was added in `addOnSaveStateListener(OnSaveInstanceStateListener)`.