Search in sources :

Example 1 with HttpURLConnectionTelemetryClient

use of org.mozilla.telemetry.net.HttpURLConnectionTelemetryClient 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);
    }
}
Also used : TelemetryEventPingBuilder(org.mozilla.telemetry.ping.TelemetryEventPingBuilder) JSONPingSerializer(org.mozilla.telemetry.serialize.JSONPingSerializer) TelemetryPingSerializer(org.mozilla.telemetry.serialize.TelemetryPingSerializer) FileTelemetryStorage(org.mozilla.telemetry.storage.FileTelemetryStorage) TelemetryStorage(org.mozilla.telemetry.storage.TelemetryStorage) FileTelemetryStorage(org.mozilla.telemetry.storage.FileTelemetryStorage) TelemetryScheduler(org.mozilla.telemetry.schedule.TelemetryScheduler) JobSchedulerTelemetryScheduler(org.mozilla.telemetry.schedule.jobscheduler.JobSchedulerTelemetryScheduler) JobSchedulerTelemetryScheduler(org.mozilla.telemetry.schedule.jobscheduler.JobSchedulerTelemetryScheduler) HttpURLConnectionTelemetryClient(org.mozilla.telemetry.net.HttpURLConnectionTelemetryClient) TelemetryClient(org.mozilla.telemetry.net.TelemetryClient) Telemetry(org.mozilla.telemetry.Telemetry) StrictMode(android.os.StrictMode) HttpURLConnectionTelemetryClient(org.mozilla.telemetry.net.HttpURLConnectionTelemetryClient) TelemetryConfiguration(org.mozilla.telemetry.config.TelemetryConfiguration) TelemetryCorePingBuilder(org.mozilla.telemetry.ping.TelemetryCorePingBuilder) Resources(android.content.res.Resources)

Aggregations

Resources (android.content.res.Resources)1 StrictMode (android.os.StrictMode)1 Telemetry (org.mozilla.telemetry.Telemetry)1 TelemetryConfiguration (org.mozilla.telemetry.config.TelemetryConfiguration)1 HttpURLConnectionTelemetryClient (org.mozilla.telemetry.net.HttpURLConnectionTelemetryClient)1 TelemetryClient (org.mozilla.telemetry.net.TelemetryClient)1 TelemetryCorePingBuilder (org.mozilla.telemetry.ping.TelemetryCorePingBuilder)1 TelemetryEventPingBuilder (org.mozilla.telemetry.ping.TelemetryEventPingBuilder)1 TelemetryScheduler (org.mozilla.telemetry.schedule.TelemetryScheduler)1 JobSchedulerTelemetryScheduler (org.mozilla.telemetry.schedule.jobscheduler.JobSchedulerTelemetryScheduler)1 JSONPingSerializer (org.mozilla.telemetry.serialize.JSONPingSerializer)1 TelemetryPingSerializer (org.mozilla.telemetry.serialize.TelemetryPingSerializer)1 FileTelemetryStorage (org.mozilla.telemetry.storage.FileTelemetryStorage)1 TelemetryStorage (org.mozilla.telemetry.storage.TelemetryStorage)1