//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//
package com.microsoft.cognitiveservices.speech.util;

import android.content.Context;
import com.microsoft.cognitiveservices.speech.util.HttpClient;

/*! \cond INTERNAL */

/**
 * TelemetryManager class for Android.
 * Telemetry on Android needs the Java layer for HTTP requests.
 * This file will replace TelemetryManager.java during generating the build files.
 */
public class TelemetryManager {

    private volatile static TelemetryManager singleton;
    private TelemetryManager() {
        client = new HttpClient();
    }
    public static TelemetryManager getSingleton() {
        if (singleton == null) {
            synchronized (TelemetryManager.class) {
                if (singleton == null) {
                    try {
                        System.loadLibrary("Microsoft.CognitiveServices.Speech.extension.telemetry");
                    } catch(java.lang.Exception ex2) {
                        System.loadLibrary("Microsoft.CognitiveServices.Speech.extension.telemetry");
                    }
                    singleton = new TelemetryManager();
                }
            }
        }
        return singleton;
    }

    private HttpClient client;
}

/*! \endcond */
