# flutter_plugin_android_lifecycle 2.0.33

Flutter plugin for accessing an Android Lifecycle within other plugins.




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'flutter_plugin_android_lifecycle:2.0.33'
```
Published: 2025-11-21T19:33:31.194092Z
Expected archive SHA-256: ee8068e0e1cd16c4a82714119918efdeed33b3ba7772c54b5d094ab53f9b7fd1

Available in cache; verification: upstream_checksum
## Direct dependencies
- flutter: map[sdk:flutter]

## Package README (untrusted upstream documentation)
# Flutter Android Lifecycle Plugin

[![pub package](https://img.shields.io/pub/v/flutter_plugin_android_lifecycle.svg)](https://pub.dev/packages/flutter_plugin_android_lifecycle)

A Flutter plugin for Android to allow other Flutter plugins to access  Android `Lifecycle` objects
in the plugin's binding.

The purpose of having this plugin instead of exposing an Android `Lifecycle` object in the engine's
Android embedding plugins API is to force plugins to have a pub constraint that signifies the
major version of the Android `Lifecycle` API they expect.

|             | Android |
|-------------|---------|
| **Support** | SDK 21+ |

## Example

Use a `FlutterLifecycleAdapter` within another Flutter plugin's Android implementation, as shown
below:

```java
import androidx.lifecycle.Lifecycle;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding;
import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter;

public class MyPlugin implements FlutterPlugin, ActivityAware {
  @Override
  public void onAttachedToActivity(ActivityPluginBinding binding) {
    Lifecycle lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(binding);
    // Use lifecycle as desired.
  }

  //...
}
```

[Feedback welcome](https://github.com/flutter/flutter/issues) and
[Pull Requests](https://github.com/flutter/packages/pulls) are most welcome!

## Changelog
## 2.0.33

* Bumps com.android.tools.build:gradle from 8.12.1 to 8.13.1.

## 2.0.32

* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9.

## 2.0.31

* Resolves Gradle 9 deprecations.

## 2.0.30

* Bumps com.android.tools.build:gradle to 8.12.1.
* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.

## 2.0.29

* Updates kotlin version to 2.2.0 to enable gradle 8.11 support.

## 2.0.28

* Removes obsolete code related to supporting SDK <21.

## 2.0.27

* Bumps flutter supported version to 3.27 and use flutter.compileSdkVersion.

## 2.0.26

* Removes flutter.compileSdkVersion for 35 to support flutter versions prior to 3.27.

## 2.0.25

* Updates compileSdk 35 to flutter.compileSdkVersion.

## 2.0.24

* Updates annotation to 1.9.1.

## 2.0.23

* Updates Java compatibility version to 11.
* Updates minimum supported SDK version to Flutter 3.24/Dart 3.5.

## 2.0.22

* Bumps `com.android.tools.build:gradle` from 7.2.1 to 8.5.1.

## 2.0.21

* Updates lint checks to ignore NewerVersionAvailable.

## 2.0.20

* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
* Removes support for apps using the v1 Android embedding.

## 2.0.19

* Updates minSdkVersion to 19.
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.

## 2.0.18

* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
* Updates compileSdk version to 34.

## 2.0.17

* Updates annotations lib to 1.7.0.

## 2.0.16

* Adds pub topics to package metadata.
* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19.

## 2.0.15

* Fixes Java lints.
* Updates minimum supported SDK version to Flutter 3.3/Dart 2.18.

## 2.0.14

* Fixes compatibility with ActivityPluginBinding.

## 2.0.13

* Fixes compatibility with AGP versions older than 4.2.

## 2.0.12

* Adds `targetCompatibilty` matching `sourceCompatibility` for older toolchains.

## 2.0.11

* Adds a namespace for compatibility with AGP 8.0.

## 2.0.10

* Sets an explicit Java compatibility version.
* Aligns Dart and Flutter SDK constraints.

## 2.0.9

* Updates annotation and espresso dependencies.
* Updates compileSdkVersion to 33.

## 2.0.8

* Updates links for the merge of flutter/plugins into flutter/packages.
* Updates minimum Flutter version to 3.0.

## 2.0.7

* Bumps gradle from 3.5.0 to 7.2.1.

## 2.0.6

* Adds OS version support information to README.
* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors
  lint warnings.

## 2.0.5

* Updates compileSdkVersion to 31.

## 2.0.4

* Updated Android lint settings.
* Remove placeholder Dart file.

## 2.0.3

* Remove references to the Android V1 embedding.

## 2.0.2

* Migrate maven repo from jcenter to mavenCentral.

## 2.0.1

* Make sure androidx.lifecycle.DefaultLifecycleObservable doesn't get shrunk away.

## 2.0.0

* Bump Dart SDK for null-safety compatibility.
* Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276))

## 1.0.12

* Update Flutter SDK constraint.

## 1.0.11

* Keep handling deprecated Android v1 classes for backward compatibility.

## 1.0.10

* Update android compileSdkVersion to 29.

## 1.0.9

* Let the no-op plugin implement the `FlutterPlugin` interface.

## 1.0.8

* Post-v2 Android embedding cleanup.

## 1.0.7

* Update Gradle version. Fixes https://github.com/flutter/flutter/issues/48724.
* Fix CocoaPods podspec lint warnings.

## 1.0.6

* Make the pedantic dev_dependency explicit.

## 1.0.5

* Add notice in example this plugin only provides Android Lifecycle API.

## 1.0.4

* Require Flutter SDK 1.12.13 or greater.
* Change to avoid reflection.

## 1.0.3

* Remove the deprecated `author:` field from pubspec.yaml
* Require Flutter SDK 1.10.0 or greater.

## 1.0.2

* Adapt to the embedding API changes in https://github.com/flutter/engine/pull/13280 (only supports Activity Lifecycle).

## 1.0.1
* Register the E2E plugin in the example app.

## 1.0.0

* Introduces a `FlutterLifecycleAdapter`, which can be used by other plugins to obtain a `Lifecycle`
  reference from a `FlutterPluginBinding`.







 
