A new Flutter plugin to enable flutter developer get android activity lifecycle notifications from dart.
currently, this package supports three lifecycle notifications:
- OnStart
- OnResume
- OnPause
To use this package, all you have to do is
- add flutter_android_lifecycle to your pubspec.yaml
- change your MainActivity.java or MainActivity.kt to extend FlutterAndroidLifecycleActivity
- Then you can start listening on notification lifecycle with these codes inside initState of your flutter application
for OnStart
FlutterAndroidLifecycle.listenToOnStartStream().listen((_) {
print("ONSTART CALLED");
});
for OnResume
FlutterAndroidLifecycle.listenToOnResumeStream().listen((_) {
print("ONRESUME CALLED");
});
for OnPause
FlutterAndroidLifecycle.listenToOnPauseStream().listen((_) {
print("ONPAUSE CALLED");
});
- 0.0.1
- Initial Upload
- 0.0.1+2
- Add swift version on podspec
- 0.0.1+3
- Add override onNewIntent to set new intent on Activity
- 0.0.1+4
- Upgrade kotlin version to 1.3.21
- 0.0.2
- Added
FragmentActivity
support
- Added
- 1.0.0
- Added AndroidX support
- Angga Dwi Arifandi ([email protected])