i’m quite new to the google analytics .
i’ve read a few tutorials and watched some videos . it turns out that it’s recommended to use auto-dispatching instead of manually dispatching , in order to reduce battery and CPU usage.
i’ve used “startNewSession” with the number of seconds between auto dispatching (set it to 5 minutes , which is the value of 5*60=300 seconds) , and i’ve also enabled debug mode in order to see the logs change as soon as i send the messages .
however , for some reason , no matter how long i wait , the messages aren’t sent this way .
only when i dispatch the messages manually , the log shows information that tells me that something is being sent .
why does it happen? is the time only a recommendation to the tracker ?
this is a problem since i don’t want to miss any tracks . just in case , i’ve put in the service of the app , inside the onDestroy , a call to the dispatch() method (and also call to stopSession()) . hopefully if i solve my problem , it won’t be needed .
speaking of the google analytics , do i have to call “stopSession” or does it do it automatically?
I wouldn’t bother doing it yourself manually, there is an EasyTracker jar file here you can use:
http://code.google.com/p/analytics-api-samples/downloads/detail?name=EasyTrackerAndroid_1.0.zip&can=2&q=
http://code.google.com/p/analytics-api-samples/downloads/list
This has an Activity in it that you can use, so instead of
extend Activityyou would `extend TrackedActivity’When you have extended
TrackedActivityyou can get a reference to your Tracker withEasyTracker.getTracker();That way you don’t have to worry about when where why or if to call dispatch() or stopSession()
If you get stuck, the source code is here for you to browse