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 ClassesModifier and TypeInterfaceDescriptionstatic interface -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a listener that is invoked whenever the associatedActivity'sonActivityResult(...)method is invoked.voidAdds a listener that is invoked whenever the associatedActivity'sonNewIntent(...)method is invoked.voidAdds a listener that is invoked when the associatedActivityorFragmentsaves and restores instance state.voidAdds a listener that is invoked whenever the associatedActivity'sonUserLeaveHint()method is invoked.voidAdds a listener that is invoked whenever the associatedActivity'sonWindowFocusChanged()method is invoked.voidAdds a listener that is invoked whenever the associatedActivity'sonRequestPermissionsResult(...)method is invoked.Returns theActivitythat is currently attached to theFlutterEnginethat owns thisActivityPluginBinding.Returns theLifecycleassociated with the attachedActivity.voidRemoves a listener that was added inaddActivityResultListener(PluginRegistry.ActivityResultListener).voidRemoves a listener that was added inaddOnNewIntentListener(PluginRegistry.NewIntentListener).voidRemoves a listener that was added inaddOnSaveStateListener(OnSaveInstanceStateListener).voidRemoves a listener that was added inaddOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener).voidRemoves a listener that was added inaddOnWindowFocusChangedListener(PluginRegistry.WindowFocusChangedListener).voidRemoves a listener that was added inaddRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener).
-
Method Details
-
getActivity
Returns theActivitythat is currently attached to theFlutterEnginethat owns thisActivityPluginBinding. -
getLifecycle
Returns theLifecycleassociated with the attachedActivity.Use the flutter_plugin_android_lifecycle plugin to turn the returned
Objectinto aLifecycleobject. See (https://github.com/flutter/plugins/tree/master/packages/flutter_plugin_android_lifecycle). Flutter plugins that rely onLifecycleare 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 associatedActivityorFragmentsaves and restores instance state. -
removeOnSaveStateListener
Removes a listener that was added inaddOnSaveStateListener(OnSaveInstanceStateListener).
-