content: package com.quizapp.tollywood;
  
  import android.app.Application;
  
  import com.google.android.gms.analytics.GoogleAnalytics;
  import com.google.android.gms.analytics.HitBuilders;
  import com.google.android.gms.analytics.Tracker;
  
  /**
   * Created by abhinav on 7/13/15.
   */
  public class QuizAppInit extends Application {
      /**
       * The Analytics singleton. The field is set in onCreate method override when the application
       * class is initially created.
       */
      private static GoogleAnalytics analytics;
  
      /**
       * The default app tracker. The field is from onCreate callback when the application is
       * initially created.
       */
      private static Tracker tracker;
  
      /**
       * Access to the global Analytics singleton. If this method returns null you forgot to either
       * set android:name="&lt;this.class.name&gt;" attribute on your application element in
       * AndroidManifest.xml or you are not setting this.analytics field in onCreate method override.
       */
      public static GoogleAnalytics analytics() {
          return analytics;
      }
  
      /**
       * The default app tracker. If this method returns null you forgot to either set
       * android:name="&lt;this.class.name&gt;" attribute on your application element in
       * AndroidManifest.xml or you are not setting this.tracker field in onCreate method override.
       */
      public static Tracker tracker() {
          return tracker;
      }
  
      @Override
      public void onCreate() {
          super.onCreate();
          analytics = GoogleAnalytics.getInstance(this);
  
          // TODO: Replace the tracker-id with your app one from https://www.google.com/analytics/web/
          tracker = analytics.newTracker(getResources().getString(R.string.ga_trackingId));
  
          // Provide unhandled exceptions reports. Do that first after creating the tracker
         tracker.enableExceptionReporting(true);
  
          // Enable Remarketing, Demographics & Interests reports
          // https://developers.google.com/analytics/devguides/collection/android/display-features
  //        tracker.enableAdvertisingIdCollection(true);
  
          // Enable automatic activity tracking for your app
          tracker.enableAutoActivityTracking(true);
  
          QuizAppInit.tracker().send(new HitBuilders.EventBuilder()
                  .setCategory(Tracking.APP_ACTIVITY.toString())
                  .setAction(Tracking.LAUNCH.toString())
                  .build());
      }
  }