package com.smart.sdkdemo

import android.app.Application
import com.smart.analytics.sdk.SmartAnalytics
import com.smart.analytics.sdk.config.SAChannelConfig
import com.smart.analytics.sdk.config.SAInitConfig

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        // 调试模式，建议正式版本关闭，默认关闭
        SmartAnalytics.setDebug(true)

        // 是否同意隐私政策
        val isPrivacyAgree = SmartAnalytics.isPrivacyAgree()
        if (isPrivacyAgree) {
            // 同意隐私政策后调用初始化方法
            initSmartAnalytics()
        }
    }
}

private const val TAG = "MyApp"
fun initSmartAnalytics() {
    // 同意隐私政策后调用初始化方法
    val initConfig = SAInitConfig(
        appId = "264",
        appKey = "GXvOwxAhPwjyIDDl",
        channel = SAChannelConfig.BAIDU,
        userId = "123",
        isVip = 1,
        enableOAID = false,
        customOaidCallback = {"testOaid"},
        customAndroidIdCallback = {"testAndroid"},
    )
    // TODO 需确保初始化方法返回true
    val isSuc = SmartAnalytics.init(initConfig)



}