package com.sunny.app.soft.timberkeyboardnew

import android.app.Application
import android.content.Context
import android.util.Log
import com.sunny.app.soft.timberkeyboardnew.unityad.UnityAdManager
import com.unity3d.ads.IUnityAdsInitializationListener
import com.unity3d.ads.UnityAds

class App : Application() {

    companion object {
        lateinit var appContext: Context


        const val AD_INIT = "on_action"



        var SDKOK = false




    }

    override fun onCreate() {
        super.onCreate()
        appContext = this
        initUNity()

    }


    private fun initUNity() {
        Log.d(UnityAdManager.TAG, "----------------------application init")
        UnityAds.initialize(this, UnityAdManager.unityGameID, UnityAdManager.testMode, object : IUnityAdsInitializationListener {
            override fun onInitializationComplete() {
                SDKOK = true
                UnityAdManager.loadAllAdNew()

            }

            override fun onInitializationFailed(
                error: UnityAds.UnityAdsInitializationError?,
                message: String?
            ) {
                SDKOK = false
            }

        });
    }
}