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

Closing the app leaks an IntentReceiver because of onListen #25

Closed
nanobug opened this issue Apr 25, 2019 · 2 comments
Closed

Closing the app leaks an IntentReceiver because of onListen #25

nanobug opened this issue Apr 25, 2019 · 2 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@nanobug
Copy link

nanobug commented Apr 25, 2019

Maybe there should be some 'shutdown' api to make a unregister call for the stateStreamHandler?

@AgainPsychoX
Copy link
Collaborator

AgainPsychoX commented Jun 21, 2019

As far as I know Flutter does not have API for disposing platform code on app termination. Problem is, there is no way to use onDestroy method of Activity (flutter/flutter#21982).

There is possibility to detect application life-cycle, including suspending and resuming - which potentially could be used in future 🤔 . I think it would cause onStateChanged and similar streams to be closed every time app goes suspended, so user will need to reopen the stream(s).

Further plans:

  • Add private function dispose or something in Android platform plugin class to be invoked,
  • Use Lifecycle or similar exposed by Flutter.
  • Detect certain life-cycle states (even maybe ON_DESTROY) and call the dispose function,
  • Dispose whatever needs to be disposed.

Added Good First Issue since it isn't that much hard to achieve, there are my suggestion about where/how to start working on it and this is not that critical issue.

@AgainPsychoX AgainPsychoX added the good first issue Good for newcomers label Jun 27, 2019
@AgainPsychoX AgainPsychoX self-assigned this Jun 28, 2019
@AgainPsychoX
Copy link
Collaborator

Flutter plugin registry exposes addViewDestroyListener which allows the library take a part in onDestroy of the application... I think I was blind, I did not see it...

Commit with fix landing in few minutes on develop branch, so closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants