use of org.mozilla.telemetry.Telemetry in project Rocket by mozilla-tw.
the class TelemetryWrapper method searchSelectEvent.
public static void searchSelectEvent() {
Telemetry telemetry = TelemetryHolder.get();
TelemetryEvent.create(Category.ACTION, Method.TYPE_SELECT_QUERY, Object.SEARCH_BAR).queue();
SearchEngine searchEngine = SearchEngineManager.getInstance().getDefaultSearchEngine(telemetry.getConfiguration().getContext());
telemetry.recordSearch(SearchesMeasurement.LOCATION_SUGGESTION, searchEngine.getIdentifier());
}
use of org.mozilla.telemetry.Telemetry in project Rocket by mozilla-tw.
the class TelemetryWrapper method searchEnterEvent.
private static void searchEnterEvent() {
Telemetry telemetry = TelemetryHolder.get();
TelemetryEvent.create(Category.ACTION, Method.TYPE_QUERY, Object.SEARCH_BAR).queue();
SearchEngine searchEngine = SearchEngineManager.getInstance().getDefaultSearchEngine(telemetry.getConfiguration().getContext());
telemetry.recordSearch(SearchesMeasurement.LOCATION_ACTIONBAR, searchEngine.getIdentifier());
}
use of org.mozilla.telemetry.Telemetry in project Rocket by mozilla-tw.
the class TelemetryWrapper method init.
public static void init(Context context) {
// When initializing the telemetry library it will make sure that all directories exist and
// are readable/writable.
final StrictMode.ThreadPolicy threadPolicy = StrictMode.allowThreadDiskWrites();
try {
final Resources resources = context.getResources();
final boolean telemetryEnabled = isTelemetryEnabled(context);
updateDefaultBrowserStatus(context);
updatePrefValue(context, resources.getString(R.string.pref_key_webview_version), DebugUtils.loadWebViewVersion(context));
final TelemetryConfiguration configuration = new TelemetryConfiguration(context).setServerEndpoint("https://incoming.telemetry.mozilla.org").setAppName(TELEMETRY_APP_NAME_ZERDA).setUpdateChannel(BuildConfig.BUILD_TYPE).setPreferencesImportantForTelemetry(resources.getString(R.string.pref_key_search_engine), resources.getString(R.string.pref_key_turbo_mode), resources.getString(R.string.pref_key_performance_block_images), resources.getString(R.string.pref_key_default_browser), resources.getString(R.string.pref_key_storage_save_downloads_to), resources.getString(R.string.pref_key_webview_version), resources.getString(R.string.pref_key_locale)).setCollectionEnabled(telemetryEnabled).setUploadEnabled(telemetryEnabled);
final TelemetryPingSerializer serializer = new JSONPingSerializer();
final TelemetryStorage storage = new FileTelemetryStorage(configuration, serializer);
final TelemetryClient client = new HttpURLConnectionTelemetryClient();
final TelemetryScheduler scheduler = new JobSchedulerTelemetryScheduler();
TelemetryHolder.set(new Telemetry(configuration, storage, client, scheduler).addPingBuilder(new TelemetryCorePingBuilder(configuration)).addPingBuilder(new TelemetryEventPingBuilder(configuration)).setDefaultSearchProvider(createDefaultSearchProvider(context)));
} finally {
StrictMode.setThreadPolicy(threadPolicy);
}
}
Aggregations