Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09616382 authored by Koushik Dutta's avatar Koushik Dutta
Browse files

Add Google Analytics support.

Change-Id: I81f816f2a358a36247c05a97053e948f4ea62753
parent 3c052c2d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_JAVA_LIBRARIES := bouncycastle telephony-common
LOCAL_STATIC_JAVA_LIBRARIES := guava android-support-v4 jsr305
LOCAL_STATIC_JAVA_LIBRARIES := guava android-support-v4 jsr305 libGoogleAnalyticsV2

LOCAL_MODULE_TAGS := optional

+12 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8" ?>

<resources>
  <!--Replace placeholder ID with your tracking ID-->
  <string name="ga_trackingId">UA-39737599-1</string>

  <!--Enable automatic activity tracking-->
  <bool name="ga_autoActivityTracking">false</bool>

  <!--Enable automatic exception tracking-->
  <bool name="ga_reportUncaughtExceptions">false</bool>
</resources>
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
@@ -31,6 +31,11 @@ import org.apache.http.message.BasicNameValuePair;
import java.util.ArrayList;
import java.util.List;

import com.google.analytics.tracking.android.GoogleAnalytics;
import com.google.analytics.tracking.android.Tracker;

import com.android.settings.R;

public class ReportingService extends Service {
    protected static final String TAG = "CMStats";

@@ -71,6 +76,13 @@ public class ReportingService extends Service {
        Log.d(TAG, "SERVICE: Carrier=" + deviceCarrier);
        Log.d(TAG, "SERVICE: Carrier ID=" + deviceCarrierId);

        // report to google analytics
        GoogleAnalytics ga = GoogleAnalytics.getInstance(this);
        Tracker tracker = ga.getTracker(getString(R.string.ga_trackingId));
        tracker.sendEvent(deviceName, deviceVersion, deviceCountry, null);
        tracker.close();

        // report to the cmstats service
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://stats.cyanogenmod.com/submit");
        try {