Search in sources :

Example 16 with DefaultLogSerializer

use of com.microsoft.appcenter.ingestion.models.json.DefaultLogSerializer in project mobile-center-sdk-android by Microsoft.

the class AppCenter method finishConfiguration.

@WorkerThread
private void finishConfiguration() {
    /* Load some global constants. */
    Constants.loadFromContext(mApplication);
    /* If parameters are valid, init context related resources. */
    StorageHelper.initialize(mApplication);
    /* Initialize session storage. */
    SessionContext.getInstance();
    /* Get enabled state. */
    boolean enabled = isInstanceEnabled();
    /* Init uncaught exception handler. */
    mUncaughtExceptionHandler = new UncaughtExceptionHandler();
    if (enabled) {
        mUncaughtExceptionHandler.register();
    }
    /* Init channel. */
    mLogSerializer = new DefaultLogSerializer();
    mLogSerializer.addLogFactory(StartServiceLog.TYPE, new StartServiceLogFactory());
    mLogSerializer.addLogFactory(CustomPropertiesLog.TYPE, new CustomPropertiesLogFactory());
    mChannel = new DefaultChannel(mApplication, mAppSecret, mLogSerializer, mHandler);
    mChannel.setEnabled(enabled);
    mChannel.addGroup(CORE_GROUP, DEFAULT_TRIGGER_COUNT, DEFAULT_TRIGGER_INTERVAL, DEFAULT_TRIGGER_MAX_PARALLEL_REQUESTS, null);
    if (mLogUrl != null) {
        mChannel.setLogUrl(mLogUrl);
    }
    if (!enabled) {
        NetworkStateHelper.getSharedInstance(mApplication).close();
    }
    AppCenterLog.debug(LOG_TAG, "App Center storage initialized.");
}
Also used : StartServiceLogFactory(com.microsoft.appcenter.ingestion.models.json.StartServiceLogFactory) CustomPropertiesLogFactory(com.microsoft.appcenter.ingestion.models.json.CustomPropertiesLogFactory) DefaultChannel(com.microsoft.appcenter.channel.DefaultChannel) DefaultLogSerializer(com.microsoft.appcenter.ingestion.models.json.DefaultLogSerializer) WorkerThread(android.support.annotation.WorkerThread)

Aggregations

DefaultLogSerializer (com.microsoft.appcenter.ingestion.models.json.DefaultLogSerializer)16 LogSerializer (com.microsoft.appcenter.ingestion.models.json.LogSerializer)15 Test (org.junit.Test)15 Log (com.microsoft.appcenter.ingestion.models.Log)11 ArrayList (java.util.ArrayList)11 MediumTest (android.support.test.filters.MediumTest)9 MockLogFactory (com.microsoft.appcenter.ingestion.models.json.MockLogFactory)8 Date (java.util.Date)6 SuppressLint (android.annotation.SuppressLint)5 Mockito.anyString (org.mockito.Mockito.anyString)5 HashMap (java.util.HashMap)4 LogContainer (com.microsoft.appcenter.ingestion.models.LogContainer)3 LogWithProperties (com.microsoft.appcenter.ingestion.models.LogWithProperties)3 UUID (java.util.UUID)3 JSONException (org.json.JSONException)3 File (java.io.File)2 WorkerThread (android.support.annotation.WorkerThread)1 EventLog (com.microsoft.appcenter.analytics.ingestion.models.EventLog)1 PageLog (com.microsoft.appcenter.analytics.ingestion.models.PageLog)1 StartSessionLog (com.microsoft.appcenter.analytics.ingestion.models.StartSessionLog)1