Closed namini40 closed 1 year ago
any ideas on this one?
Hi @namini40,
When it comes to Adjust Flutter SDK, we are interested in receiving app lifecycle callbacks because that information is needed for Android part of the SDK to be able to properly perform sessions tracking (we need information about app going to background and foreground). In theory, usage of WidgetsBindingObserver
in order to get these activity lifecycle callback methods is something we saw as a way how Flutter devs were doing this mostly back in the days when we wrote the docs. Truth is that you are not really forced to follow that pattern in case that doesn't suit you for whatever reason. Only thing which you should keep in mind for Adjust SDK setup is that "you should make a call to Adjust.onResume()
whenever your app comes to foreground and a call to Adjust.onPause()
whenever your app goes to background". How exactly you intend to do that, that is fully up to you. If the way we suggest in our docs is not working for your app's use case and you know of better way to do that, we'd love to hear about it and update our docs in case there's room for improvement.
Cheers
thanks for clear response. I'll comment anything I found about other ways to do so.
Hi there, hope you doing great! According to the documentation for calling
onResume
andonPause
methods you have to useWidgetsBindingObserver
and overridedidChangeAppLifecycleState
method. if you useStatefulWidget
at the root everything will be ok. the question is I have a Flutter app which all the widgets areStateless
. I could add observer using root widget constructor. but how to dispose it?I mean in this senario what can we do for initializing Adjust?
thanks