android - Should I use reportActivityStop or reportActivityStart when onPause() or onResume() -


i'm using google analytics tracker, data comes correctly analytics account. have question. should when app go onpause() or onresume()

currently i'm using this

@override protected void onstart() {     super.onstart();     googleanalytics.getinstance(this).reportactivitystart(this); }  @override protected void onstop() {     super.onstop();     googleanalytics.getinstance(this).reportactivitystop(this); } 

is below necessary?

@override protected void onpause() {     super.onpause();     googleanalytics.getinstance(this).reportactivitystop(this); }  @override protected void onresume() {     super.onresume();     googleanalytics.getinstance(this).reportactivitystart(this); } 

android activity life cycle

i know late don't need call inside onpause , onresume stated document.

note method should called onstop() method in each activity

this method should called onstart() method in each activity

see reportactivitystart , reportactivitystop

also, if want can set following value automatically track activity(this won't track fragment). note api 14 or above.

googleanalytic.enableautoactivityreports(true) tracker.enableautoactivitytracking(true) 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

android - MPAndroidChart - How to add Annotations or images to the chart -