Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unregister ActivityLifecycleCallbacks #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GabrieleVolpato
Copy link

Any time the FlutterActivity registers for this plugin, the plugin itself registers to the ActivityLifecycleCallbacks. This is a problem because, if you close the FlutterActivity but not the application (by using the hardware back button, for instance), when you restart the activity, it registers again, causing a crash on the first onPause call.
Since Flutter only uses one FlutterActivity, it's safe to unregister for the ActivityLifecycleCallbacks when it gets destroyed.

Steps to reproduce the problem:

  • Create app using this plugin and open it once
  • Close the application by pushing the back button of your device
  • Reopen the application
  • Try to go back to your device home by using the back or home button -> CRASH.

Any time the FlutterActivity registers for this plugin, the plugin itself registers to the ActivityLifecycleCallbacks. This is a problem because, if you close the FlutterActivity but not the application (by using the hardware back button, for instance), when you restart the activity, it registers again, causing a crash on the first onPause call.
Since Flutter only uses one FlutterActivity, it's safe to unregister for the ActivityLifecycleCallbacks when it gets destroyed.

Steps to reproduce the problem:
- Create app using this plugin and open it once
- Close the application by pushing the back button of your device
- Reopen the application
- Try to go back to your device home by using the back or home button -> CRASH.
@lchinke
Copy link

lchinke commented Aug 16, 2018

This is related to flutter/flutter#20622

@vinceramcesoliveros
Copy link

Has anyone tested this out in iOS?
I havent seen someone integrate other packages wih atlbeacon on iOS.

@GabrieleVolpato
Copy link
Author

I did it, and it seems to be working as intended.

@vinceramcesoliveros
Copy link

Well, good to hear, because there are some packages(google_sign_in) that gives me an error 2 months ago.

I have a friend that has an iOS and macbook, I'll test it out later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants