package com.prankapp.fartsounds.airhorn.app;

import android.app.Application;
import android.util.Log;

import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback;
import com.prankapp.fartsounds.airhorn.openmediation.AdManager;
import com.prankapp.fartsounds.airhorn.utilsfff.Utils;

public class Application__ extends Application {
    private static String AppKey = "a706b17d04ce19de26cb3adb5b6c330ca";
    private static String APPId = "h6697383c8175b";
    private static String debug_KEy="a8dd4a3f1c38a5a3cadb4f39385fb682af63df07";
    public static String TAG = "----------tt";
    @Override
    public void onCreate() {
        super.onCreate();
        Utils.init(this);
        setTopOnGDPR();
        initTopOnSDk();
    }

    private void initTopOnSDk(){
        ATSDK.init( this, APPId, AppKey);
//        ATDebuggerUITest.showDebuggerUI(this,debug_KEy);
        AdManager.loadAllAd();
    }

    private void setTopOnGDPR(){
//        ATSDK.PERSONALIZED //设备数据允许上报
//        ATSDK.NONPERSONALIZED //设备数据不允许上报
//        ATSDK.UNKNOWN //未知等级，只能通过getGDPRDataLevel方法获取，不能用setGDPRUploadDataLevel方法设置
//        ATSDK.setGDPRUploadDataLevel(this, ATSDK.PERSONALIZED);

        ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {

            @Override
            public void onResultCallback(boolean isEU) {
                Log.e(TAG, "onResultCallback:" + isEU);
                if (isEU && ATSDK.getGDPRDataLevel(Application__.this) == ATSDK.UNKNOWN) {
                    ATSDK.showGdprAuth(Application__.this);
                }

            }

            @Override
            public void onErrorCallback(String errorMsg) {
                Log.e(TAG, "onErrorCallback:" + errorMsg);
            }
        });


    }

}
