Flutter Engine
The Flutter Engine
|
Public Member Functions | |
void | onAttachedToActivity (@NonNull ActivityPluginBinding binding) |
void | onDetachedFromActivityForConfigChanges () |
void | onReattachedToActivityForConfigChanges (@NonNull ActivityPluginBinding binding) |
void | onDetachedFromActivity () |
io.flutter.embedding.engine.plugins.FlutterPlugin
that is interested in android.app.Activity
lifecycle events related to a io.flutter.embedding.engine.FlutterEngine
running within the given android.app.Activity
.
Definition at line 14 of file ActivityAware.java.
void io.flutter.embedding.engine.plugins.activity.ActivityAware.onAttachedToActivity | ( | @NonNull ActivityPluginBinding | binding | ) |
This ActivityAware
io.flutter.embedding.engine.plugins.FlutterPlugin
is now associated with an android.app.Activity
.
This method can be invoked in 1 of 2 situations:
ActivityAware
io.flutter.embedding.engine.plugins.FlutterPlugin
was just added to a io.flutter.embedding.engine.FlutterEngine
that was already connected to a running android.app.Activity
. ActivityAware
io.flutter.embedding.engine.plugins.FlutterPlugin
was already added to a io.flutter.embedding.engine.FlutterEngine
and that io.flutter.embedding.engine.FlutterEngine
was just connected to an android.app.Activity
. The given ActivityPluginBinding
contains android.app.Activity
-related references that an ActivityAware
io.flutter.embedding.engine.plugins.FlutterPlugin
may require, such as a reference to the actual android.app.Activity
in question. The ActivityPluginBinding
may be referenced until either onDetachedFromActivityForConfigChanges()
or onDetachedFromActivity()
is invoked. At the conclusion of either of those methods, the binding is no longer valid. Clear any references to the binding or its resources, and do not invoke any further methods on the binding or its resources.
void io.flutter.embedding.engine.plugins.activity.ActivityAware.onDetachedFromActivity | ( | ) |
This plugin has been detached from an android.app.Activity
.
Detachment can occur for a number of reasons.
android.app.Activity
instance has been destroyed. io.flutter.embedding.engine.FlutterEngine
that this plugin is connected to has been detached from its io.flutter.embedding.android.FlutterView
. ActivityAware
plugin has been removed from its io.flutter.embedding.engine.FlutterEngine
. By the end of this method, the android.app.Activity
that was made available in onAttachedToActivity(ActivityPluginBinding)
is no longer valid. Any references to the associated android.app.Activity
or ActivityPluginBinding
should be cleared.
Any Lifecycle
listeners that were registered in onAttachedToActivity(ActivityPluginBinding)
or onReattachedToActivityForConfigChanges(ActivityPluginBinding)
should be deregistered here to avoid a possible memory leak and other side effects.
void io.flutter.embedding.engine.plugins.activity.ActivityAware.onDetachedFromActivityForConfigChanges | ( | ) |
The android.app.Activity
that was attached and made available in onAttachedToActivity(ActivityPluginBinding)
has been detached from this
's
ActivityAwareio.flutter.embedding.engine.FlutterEngine
for the purpose of processing a configuration change.
By the end of this method, the android.app.Activity
that was made available in onAttachedToActivity(ActivityPluginBinding)
is no longer valid. Any references to the associated android.app.Activity
or ActivityPluginBinding
should be cleared.
This method should be quickly followed by onReattachedToActivityForConfigChanges(ActivityPluginBinding)
, which signifies that a new android.app.Activity
has been created with the new configuration options. That method provides a new ActivityPluginBinding
, which references the newly created and associated android.app.Activity
.
Any Lifecycle
listeners that were registered in onAttachedToActivity(ActivityPluginBinding)
should be deregistered here to avoid a possible memory leak and other side effects.
void io.flutter.embedding.engine.plugins.activity.ActivityAware.onReattachedToActivityForConfigChanges | ( | @NonNull ActivityPluginBinding | binding | ) |
This plugin and its io.flutter.embedding.engine.FlutterEngine
have been re-attached to an android.app.Activity
after the android.app.Activity
was recreated to handle configuration changes.
binding
includes a reference to the new instance of the android.app.Activity
. binding
and its references may be cached and used from now until either onDetachedFromActivityForConfigChanges()
or onDetachedFromActivity()
is invoked. At the conclusion of either of those methods, the binding is no longer valid. Clear any references to the binding or its resources, and do not invoke any further methods on the binding or its resources.