I am trying to integrate Google Analytics into my Android project using the information on the website of the corresponding SDK . However, very little documentation is available. My project has 6 different activities, and I noticed that using the method on the website leads to a unique visit to Google Analytics for each open activity, even if it is still in the same session. Apparently, Google Analytics for Android never uses a previously reused session.
Their method is to start tracking activity in onCreate, and then stop tracking in onDestroy. The problem with this is that the session will remain active if the user clicks the home button instead of the back button because the action will not be destroyed. So I decided to do this in onResume and onPause, but that means that new sessions open when a new action is opened.
Does anyone know of any way to really track a single session in multiple actions?
source
share