Newer
Older
OverlayMultiCounter / app / src / main / kotlin / jackall / overlaymulticounter / utils / AdUtil.kt
MatsumotoKeiju on 10 Nov 2017 817 bytes [add] Ad util
package jackall.overlaymulticounter.utils

import android.content.Context
import android.widget.FrameLayout
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.AdSize
import com.google.android.gms.ads.AdView
import com.google.android.gms.ads.MobileAds

/**
 * Created by matsumoto_k on 2017/11/10.
 */
class AdUtil {
    companion object {
        fun startBannerAd(context: Context, frameLayout: FrameLayout, adSize: AdSize, unitId: String) {
            MobileAds.initialize(context)
            val adBannerView = AdView(context)
            adBannerView.adSize = adSize
            adBannerView.adUnitId = unitId
            frameLayout.addView(adBannerView)
            val adBannerRequest = AdRequest.Builder().build()
            adBannerView.loadAd(adBannerRequest)
        }
    }
}