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

Device Info plugin should not try to access the activity during registration #24633

Closed
alanrussian opened this issue Nov 21, 2018 · 2 comments
Closed

Comments

@alanrussian
Copy link
Contributor

In order to support background execution, plugins can't store the activity as a field during registration time because the activity may not yet be available. The device info plugin was recently changed to do this.

https://github.com/flutter/plugins/blob/master/packages/device_info/android/src/main/java/io/flutter/plugins/deviceinfo/DeviceInfoPlugin.java#L33

@alanrussian
Copy link
Contributor Author

Two possible fixes:

  • If the application context will work, store the application context instead of the activity context. IIRC you can do this with the Registrar#context method.

  • If the activity context is required, store the Registrar and call Registrar#activity when its used.

mehmetf pushed a commit to flutter/plugins that referenced this issue Nov 22, 2018
Using activity() causes a crash if the plugin is registered before the activity.

Fixes flutter/flutter#24633
andreidiaconu pushed a commit to andreidiaconu/plugins that referenced this issue Feb 17, 2019
Using activity() causes a crash if the plugin is registered before the activity.

Fixes flutter/flutter#24633
@github-actions
Copy link

github-actions bot commented Sep 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant