Open potter420 opened 2 years ago
Hi @potter420 thanks for your patience here.
This is not officially supported in our API, but it will be possible in the next update to the Developer Preview Release for Analytics.
When creating an instance of Analytics, you can pass your own implementation of the AppLifecycleProvider
class.
AmplifyAnalyticsPinpoint(
appLifecycleProvider: myAppLifecycleProvider,
)
When this class calls the provided onForeground
and onBackground
methods a new session will be started or stopped (please note a new session can only be started if it was stopped before).
This isn't officially supported because the appLifecycleProvider is marked as 'visibleForTesting' as we are still evaluating how we should expose this functionality publicly. But for now you can use it for your use case and we can update you on future changes.
There might be a better way to handle this for you guys. I will investigate a bit internally for a solution.
We would like to manually stop then start a session in-app after certain actions. For example: When user logout, we want to stop and start a new session for tracking
How can we do this with the existing API or can we expose the
StartSession
method. I saw that we have a start session methods.Thank you.