mirror of https://github.com/tasks/tasks
Added setting for turning analytics on and off
parent
bd24ffc7ae
commit
2c4d39d2e2
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- See the file "LICENSE" for the full license governing this code. -->
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- ================================================== EditPreferences == -->
|
||||||
|
|
||||||
|
<!-- Preference Category: Power Pack -->
|
||||||
|
<string name="EPr_powerpack_header">Astrid Power Pack</string>
|
||||||
|
|
||||||
|
<!-- Preference: Anonymous User Statistics -->
|
||||||
|
<string name="EPr_statistics_title">Anonymous Usage Stats</string>
|
||||||
|
<!-- Preference: User Statistics (disabled) -->
|
||||||
|
<string name="EPr_statistics_desc_disabled">No usage data will be reported</string>
|
||||||
|
<!-- Preference: User Statistics (enabled) -->
|
||||||
|
<string name="EPr_statistics_desc_enabled">Help us make Astrid better by sending anonymous usage data</string>
|
||||||
|
|
||||||
|
</resources>
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* See the file "LICENSE" for the full license governing this code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.todoroo.astrid.service;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.flurry.android.FlurryAgent;
|
||||||
|
import com.timsu.astrid.R;
|
||||||
|
import com.todoroo.andlib.utility.Preferences;
|
||||||
|
import com.todoroo.astrid.utility.Constants;
|
||||||
|
|
||||||
|
public class StatisticsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate session started
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void sessionStart(Context context) {
|
||||||
|
if(dontCollectStatistics())
|
||||||
|
return;
|
||||||
|
|
||||||
|
FlurryAgent.onStartSession(context, Constants.FLURRY_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate session ended
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void sessionStop(Context context) {
|
||||||
|
if(dontCollectStatistics())
|
||||||
|
return;
|
||||||
|
|
||||||
|
FlurryAgent.onEndSession(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void reportError(String name, String message, String trace) {
|
||||||
|
if(dontCollectStatistics())
|
||||||
|
return;
|
||||||
|
|
||||||
|
FlurryAgent.onError(name, message, trace);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void reportEvent(String event) {
|
||||||
|
if(dontCollectStatistics())
|
||||||
|
return;
|
||||||
|
|
||||||
|
FlurryAgent.onEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean dontCollectStatistics() {
|
||||||
|
return !Preferences.getBoolean(R.string.p_statistics, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue