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
Modifier and TypeInterfaceDescriptionstatic interface
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener that is invoked whenever the associatedActivity
'sonActivityResult(...)
method is invoked.void
Adds a listener that is invoked whenever the associatedActivity
'sonNewIntent(...)
method is invoked.void
Adds a listener that is invoked when the associatedActivity
orFragment
saves and restores instance state.void
Adds a listener that is invoked whenever the associatedActivity
'sonUserLeaveHint()
method is invoked.void
Adds a listener that is invoked whenever the associatedActivity
'sonWindowFocusChanged()
method is invoked.void
Adds a listener that is invoked whenever the associatedActivity
'sonRequestPermissionsResult(...)
method is invoked.Returns theActivity
that is currently attached to theFlutterEngine
that owns thisActivityPluginBinding
.Returns theLifecycle
associated with the attachedActivity
.void
Removes a listener that was added inaddActivityResultListener(PluginRegistry.ActivityResultListener)
.void
Removes a listener that was added inaddOnNewIntentListener(PluginRegistry.NewIntentListener)
.void
Removes a listener that was added inaddOnSaveStateListener(OnSaveInstanceStateListener)
.void
Removes a listener that was added inaddOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener)
.void
Removes a listener that was added inaddOnWindowFocusChangedListener(PluginRegistry.WindowFocusChangedListener)
.void
Removes a listener that was added inaddRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener)
.
-
Method Details
-
getActivity
Returns theActivity
that is currently attached to theFlutterEngine
that owns thisActivityPluginBinding
. -
getLifecycle
Returns theLifecycle
associated with the attachedActivity
.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. -
addRequestPermissionsResultListener
void addRequestPermissionsResultListener(@NonNull PluginRegistry.RequestPermissionsResultListener listener) Adds a listener that is invoked whenever the associatedActivity
'sonRequestPermissionsResult(...)
method is invoked. -
removeRequestPermissionsResultListener
void removeRequestPermissionsResultListener(@NonNull PluginRegistry.RequestPermissionsResultListener listener) Removes a listener that was added inaddRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener)
. -
addActivityResultListener
Adds a listener that is invoked whenever the associatedActivity
'sonActivityResult(...)
method is invoked. -
removeActivityResultListener
Removes a listener that was added inaddActivityResultListener(PluginRegistry.ActivityResultListener)
. -
addOnNewIntentListener
Adds a listener that is invoked whenever the associatedActivity
'sonNewIntent(...)
method is invoked. -
removeOnNewIntentListener
Removes a listener that was added inaddOnNewIntentListener(PluginRegistry.NewIntentListener)
. -
addOnUserLeaveHintListener
Adds a listener that is invoked whenever the associatedActivity
'sonUserLeaveHint()
method is invoked. -
removeOnUserLeaveHintListener
Removes a listener that was added inaddOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener)
. -
addOnWindowFocusChangedListener
Adds a listener that is invoked whenever the associatedActivity
'sonWindowFocusChanged()
method is invoked. -
removeOnWindowFocusChangedListener
void removeOnWindowFocusChangedListener(@NonNull PluginRegistry.WindowFocusChangedListener listener) Removes a listener that was added inaddOnWindowFocusChangedListener(PluginRegistry.WindowFocusChangedListener)
. -
addOnSaveStateListener
Adds a listener that is invoked when the associatedActivity
orFragment
saves and restores instance state. -
removeOnSaveStateListener
Removes a listener that was added inaddOnSaveStateListener(OnSaveInstanceStateListener)
.
-