Loading Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-v7-cardview \ android-support-v13 \ jsr305 \ libGoogleAnalyticsV2 libGoogleAnalyticsV3 LOCAL_MODULE_TAGS := optional Loading src/com/android/settings/cmstats/ReportingService.java +14 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.settings.Settings; import com.google.analytics.tracking.android.GoogleAnalytics; import com.google.analytics.tracking.android.Tracker; import com.google.analytics.tracking.android.MapBuilder; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; Loading @@ -40,6 +41,7 @@ import org.apache.http.message.BasicNameValuePair; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; public class ReportingService extends Service { /* package */ static final String TAG = "CMStats"; Loading Loading @@ -81,9 +83,9 @@ public class ReportingService extends Service { Log.d(TAG, "SERVICE: Carrier ID=" + deviceCarrierId); // report to google analytics GoogleAnalytics ga = GoogleAnalytics.getInstance(ReportingService.this); Tracker tracker = ga.getTracker(getString(R.string.ga_trackingId)); tracker.sendEvent(deviceName, deviceVersion, deviceCountry, null); Tracker tracker = GoogleAnalytics.getInstance(ReportingService.this) .getTracker(getString(R.string.ga_trackingId)); tracker.send(createMap(deviceName, deviceVersion,deviceCountry)); // this really should be set at build time... // format of version should be: Loading @@ -97,9 +99,8 @@ public class ReportingService extends Service { } if (deviceVersionNoDevice != null) { tracker.sendEvent("checkin", deviceName, deviceVersionNoDevice, null); tracker.send(createMap("checkin", deviceName, deviceVersionNoDevice)); } tracker.close(); // report to the cmstats service HttpClient httpClient = new DefaultHttpClient(); Loading Loading @@ -146,4 +147,12 @@ public class ReportingService extends Service { stopSelf(); } } private Map<String, String> createMap(String category, String action, String label) { return MapBuilder.createEvent(category, // Event category (required) action, // Event action (required) label, // Event label null) // Event value .build(); } } src/com/android/settings/cmstats/ReportingServiceManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ public class ReportingServiceManager extends BroadcastReceiver { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisFromNow, PendingIntent.getBroadcast(context, 0, intent, 0)); Log.d(ReportingService.TAG, "Next sync attempt in : " + millisFromNow / MILLIS_PER_HOUR + " hours"); Log.d(ReportingService.TAG, "Next sync attempt in : " + millisFromNow / MILLIS_PER_HOUR + " hours"); } public static void launchService(Context context) { Loading @@ -95,7 +96,8 @@ public class ReportingServiceManager extends BroadcastReceiver { long timeElapsed = System.currentTimeMillis() - lastSynced; if (timeElapsed < UPDATE_INTERVAL) { long timeLeft = UPDATE_INTERVAL - timeElapsed; Log.d(ReportingService.TAG, "Waiting for next sync : " + timeLeft / MILLIS_PER_HOUR + " hours"); Log.d(ReportingService.TAG, "Waiting for next sync : " + timeLeft / MILLIS_PER_HOUR + " hours"); return; } Loading Loading
Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-v7-cardview \ android-support-v13 \ jsr305 \ libGoogleAnalyticsV2 libGoogleAnalyticsV3 LOCAL_MODULE_TAGS := optional Loading
src/com/android/settings/cmstats/ReportingService.java +14 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.settings.Settings; import com.google.analytics.tracking.android.GoogleAnalytics; import com.google.analytics.tracking.android.Tracker; import com.google.analytics.tracking.android.MapBuilder; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; Loading @@ -40,6 +41,7 @@ import org.apache.http.message.BasicNameValuePair; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; public class ReportingService extends Service { /* package */ static final String TAG = "CMStats"; Loading Loading @@ -81,9 +83,9 @@ public class ReportingService extends Service { Log.d(TAG, "SERVICE: Carrier ID=" + deviceCarrierId); // report to google analytics GoogleAnalytics ga = GoogleAnalytics.getInstance(ReportingService.this); Tracker tracker = ga.getTracker(getString(R.string.ga_trackingId)); tracker.sendEvent(deviceName, deviceVersion, deviceCountry, null); Tracker tracker = GoogleAnalytics.getInstance(ReportingService.this) .getTracker(getString(R.string.ga_trackingId)); tracker.send(createMap(deviceName, deviceVersion,deviceCountry)); // this really should be set at build time... // format of version should be: Loading @@ -97,9 +99,8 @@ public class ReportingService extends Service { } if (deviceVersionNoDevice != null) { tracker.sendEvent("checkin", deviceName, deviceVersionNoDevice, null); tracker.send(createMap("checkin", deviceName, deviceVersionNoDevice)); } tracker.close(); // report to the cmstats service HttpClient httpClient = new DefaultHttpClient(); Loading Loading @@ -146,4 +147,12 @@ public class ReportingService extends Service { stopSelf(); } } private Map<String, String> createMap(String category, String action, String label) { return MapBuilder.createEvent(category, // Event category (required) action, // Event action (required) label, // Event label null) // Event value .build(); } }
src/com/android/settings/cmstats/ReportingServiceManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ public class ReportingServiceManager extends BroadcastReceiver { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisFromNow, PendingIntent.getBroadcast(context, 0, intent, 0)); Log.d(ReportingService.TAG, "Next sync attempt in : " + millisFromNow / MILLIS_PER_HOUR + " hours"); Log.d(ReportingService.TAG, "Next sync attempt in : " + millisFromNow / MILLIS_PER_HOUR + " hours"); } public static void launchService(Context context) { Loading @@ -95,7 +96,8 @@ public class ReportingServiceManager extends BroadcastReceiver { long timeElapsed = System.currentTimeMillis() - lastSynced; if (timeElapsed < UPDATE_INTERVAL) { long timeLeft = UPDATE_INTERVAL - timeElapsed; Log.d(ReportingService.TAG, "Waiting for next sync : " + timeLeft / MILLIS_PER_HOUR + " hours"); Log.d(ReportingService.TAG, "Waiting for next sync : " + timeLeft / MILLIS_PER_HOUR + " hours"); return; } Loading