getx
getx copied to clipboard
not able to find GetxService when app goes to background....
getting error message GetxService
not found when app in to background ....
you get following error message when app in background... it works perfectly when app in Foreground.
"MessageService" not found. You need to call "Get.put(MessageService())" or "Get.lazyPut(()=>MessageService())"
Please check...
Yes. Same issue here.
@jonataslaw can you please help us with this issue...??
@jonataslaw @jasonlaw @lsm Any workarounds for this.?
So I was running into a service disappearing in my app which was not disappearing before. The Smart Management decided to ditch that service. I have a feeling that maybe it has to do something with the fact that I started to obey Android Studio linting suggestions and applied a lot of const
keywords and alike and maybe that showed some memory objects more discardable than before, but that is just really a guess.
The bottom line is - try to tell Get
to keep your service in the memory by utilizing the permanent
named parameter of put
, like so: Get.put(MessageService(), permanent: true)
. Of course this has some consequences such as you need to take control when you want to discard that service manually, so you have to command the lifecycle of the service on your own.
@MrCsabaToth, this issue is different... the GetXService is not available when app goes to background....
@jonataslaw @jasonlaw @lsm please suggest any temporary solution for this...
the GetXService is not available when app goes to background....
From your issue opening description it looks like that MessageService
is not available. What is GetXService
? We need some code, can you point to a repository? Or some more complete error message. From what you quoted originally it seems like to me that either GetX's or Flutter memory management cleans / garbage collects the MessageService
.
Regarding background: I had trouble with background functionality before (not GetX, but bluetooth data stream coming in) and such issues can be even hard to solve if someone is on a native Android playground. Flutter just adds another layer of abstraction of over that. So looking at the big picture I'd consider exploring background tasks + Flutter such as https://flutter.dev/docs/development/packages-and-plugins/background-processes or https://pub.dev/packages/workmanager
Also: talking about layer of abstractions background tasks' topic opens another can of worms: https://dontkillmyapp.com/
Have same issue. Any solution for this @jonataslaw?
https://github.com/jonataslaw/getx/issues/3029 The same issue
Same issue, haizzz