Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
io.flutter.embedding.engine.plugins.activity.ActivityAware Interface Reference

Public Member Functions

void onAttachedToActivity (@NonNull ActivityPluginBinding binding)
 
void onDetachedFromActivityForConfigChanges ()
 
void onReattachedToActivityForConfigChanges (@NonNull ActivityPluginBinding binding)
 
void onDetachedFromActivity ()
 

Detailed Description

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.

Member Function Documentation

◆ onAttachedToActivity()

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:

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.

◆ onDetachedFromActivity()

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.

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.

◆ onDetachedFromActivityForConfigChanges()

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
ActivityAware
's io.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.

◆ onReattachedToActivityForConfigChanges()

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.


The documentation for this interface was generated from the following file: