package com.handset.serialportsensor;

import android.support.multidex.MultiDexApplication;

import com.blankj.utilcode.util.Utils;
import com.handset.serialportsensor.account.AccountManager;
import com.handset.serialportsensor.db.DBUpdateHelperMY;
import com.handset.serialportsensor.utils.CrashHandler;
import com.handset.serialportsensor.utils.PersistHelper;
import com.handset.serialportsensor.utils.Slog;

import net.danlew.android.joda.JodaTimeAndroid;

import org.kymjs.kjframe.KJDB;

public class App extends MultiDexApplication {
    static boolean debug = BuildConfig.DEBUG;

    @Override
    public void onCreate() {
        super.onCreate();

        Utils.init(this);

        JodaTimeAndroid.init(this);

        Slog.init(this);
        Slog.setDebug(true, true);
        Slog.enableSaveLog(true);

        KJDB.create(this, "htjc_sensor_history.db", !debug, DBUpdateHelperMY.DATABASE_VERSION, new DBUpdateHelperMY());

        /*
         * 初始化账户组件，不使用自动登录
         * */
        AccountManager.init((this), debug);

        //保存Crash的Log
        CrashHandler crashHandler = CrashHandler.getInstance();
        crashHandler.init(getApplicationContext());

        PersistHelper.init((this));
    }
}
