-
Notifications
You must be signed in to change notification settings - Fork 51
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
We cannot maintain the class objects, when application was terminated. #48
Comments
Can you provide me a reproducible example? You are calling a method Did you init the container in the background as well? |
i have injected from class constructor through kiwi .
but inside top-level function is not getting those objects. |
|
any solutions about this issue? |
Oh I'm sorry I completely forgot. Today I have time to investigate. |
@saravananmnm can you provide me with a small working example? That I can run that has this specific issue? Meanwhile I am looking at https://pub.dev/packages/background_fetch how it works and trying to create a working example for myself |
|
|
@saravananmnm I tried the following and everything was working for me. I assume this problem is only present on Andriod? Because on iOS it is not possible to fetch when the app is terminated EXAMPLE
|
|
@saravananmnm Your example does not include the I need an example that I can copy and past in my editor run it and it should work just like that. So remove the geolocation as well that is not related to this problem. So create a minimal example |
|
diConfig is not yet available |
|
Alright thanks. I just got the same error in my example as well after taking a look at your full example. I am first taking a deeper look into headless dart code. How it exactly works. |
Alright @vanlooverenkoen fine. Let me know your solutions. |
@saravananmnm 1 more question are you having this problem only on Android? Because iOS won't run when the app is terminated? Or on both platforms? |
@vanlooverenkoen Am faced this issue from both plarforms. |
And the app is completely terminated? Removed from recents. Or is the app just in the background? |
Yes @vanlooverenkoen. App is terminated from recent activities. |
transistorsoft/flutter_background_fetch#32 (comment) How is it possible that you can run a headless implemation on iOS? That is not supported by iOS itself. |
Regarding the Android problem this is because android will release these objects. Only the callback can bu used to trigger dart code. The sollution that works is to call your diConfig() in you too level function. This wil offcourse result in new objects but. But the kiwi container wil have all the objects you registered. As far as I can see there is no way to keep these the objects in the KiwiContainer. So calling diConfig() again is the way to go. |
Thanks for the solution @vanlooverenkoen.It's save my day. |
@saravananmnm no problem. Sorry it took so long. |
The text was updated successfully, but these errors were encountered: