Using Google Analytics for Android Widget

I want to use Google Analytics for the first time.

I have a simple widget and when I click on it a simple action opens. Not that hard. I put the following code in the onCreate method of my activity:

public static GoogleAnalytics analytics;
public static Tracker tracker;


... from here in onCreate

if(analytics == null || tracker == null){
            analytics = GoogleAnalytics.getInstance(this);
            analytics.setLocalDispatchPeriod(1800);

            tracker = analytics.newTracker("UA-11111111-1");
            tracker.enableExceptionReporting(true);
            tracker.enableAdvertisingIdCollection(true);
            tracker.enableAutoActivityTracking(true);
        }

      

Do I need to put the same code in my AppWidgetProvider onUpdate method or is that enough? An on-screen widget is considered an active user in Google Analytics, and if so, does Google Analytics make 2 active users if they have an on-screen widget and open the app, or is Google smart enough to know that both (widget and app) are on one device?

+3
android android-widget google-analytics


source to share


No one has answered this question yet

Check out similar questions:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to persist android activity state by persisting instance state?
2097
Is there a way to run Python on Android?
1858
"Debug certificate expired" error in Android Eclipse plugins
1844
What is "Context" on Android?
4
Google Analytics Tracker Doesn't work for Android app
0
Android Google Analytics disconnects the app when I clear the app from recent apps



All Articles
Loading...
X
Show
Funny
Dev
Pics