package com.app.baselibrary.base.app;

import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;

import com.app.baselibrary.commonUtil.BDttsUtils;
import com.app.baselibrary.commonUtil.PreferencesUtils;
import com.app.baselibrary.commonUtil.SnUtils;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.oo.seex.oo_statistics_lib.OOAgent;

/**
 * 在此写用途
 * author: pl
 * date: 2017-03-10 10:05
 */

public class BaseApplication extends Application {

    //统计的根路径；
    public static final String STATISTICS_HOST_URL = "http://seexlog.ooyby.com";

    private static BaseApplication mBaseApplication;

    private static Handler UIHANDLER;

    @Override
    public void onCreate() {
        super.onCreate();
        mBaseApplication = this;
        Fresco.initialize(this);
        PreferencesUtils.putLong( "device_on_time", System.currentTimeMillis() / 1000);
        OOAgent.initShincAgent(this, SnUtils.getSN(),STATISTICS_HOST_URL);
//        OOAgent.showDebug();
        BDttsUtils.getInstance();//初始化百度语音
        //MobclickAgent.openActivityDurationTrack(false);

    }

    public static Context getAppContext() {
        return mBaseApplication;
    }

    public static Handler getUiHandler() {
        if (UIHANDLER == null) {
            UIHANDLER = new Handler(Looper.getMainLooper());
        }

        return UIHANDLER;
    }

}
