Skip to content

A Flutter plugin to notify change of android activity lifecycle to dart.

License

Notifications You must be signed in to change notification settings

anilslabs/flutter-android-lifecycle-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_android_lifecycle

A new Flutter plugin to enable flutter developer get android activity lifecycle notifications from dart.

Getting Started

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");
        });

Version

  • 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

Contributor

About

A Flutter plugin to notify change of android activity lifecycle to dart.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 43.7%
  • Dart 27.0%
  • Ruby 20.0%
  • Swift 6.3%
  • Objective-C 3.0%