diff --git a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt index e418e9c..0044248 100644 --- a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt +++ b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt @@ -11,6 +11,10 @@ import android.os.IBinder import android.support.v4.app.NotificationCompat import android.view.* +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 import jackall.moncalc.Const import jackall.moncalc.R import jackall.moncalc.activity.MainActivity @@ -25,6 +29,7 @@ import jackall.moncalc.viewmodel.OverlayViewModel import jackall.moncalc.vo.Temple import kotlinx.android.synthetic.main.move_overlay.view.* +import kotlinx.android.synthetic.main.regist_overlay.view.* /** @@ -62,7 +67,6 @@ setMoveViewConfig() setRegistViewConfig() - setAdConfig() showMoveView() @@ -130,12 +134,12 @@ registBinding.templeSpinner.adapter = templeSpinnerAdapter } - fun setAdConfig(){ + fun showOverlayBannerAd() { MobileAds.initialize(this) val adBannerView = AdView(this) adBannerView.adSize = AdSize.BANNER - adBannerView.adUnitId = Const.bannerUnitId - adViewBannerLayout.addView(adBannerView) + adBannerView.adUnitId = Const.overlayBannerUnitId + registBinding.root.overlayBannerLayout.addView(adBannerView) val adBannerRequest = AdRequest.Builder().build() adBannerView.loadAd(adBannerRequest) } @@ -152,6 +156,7 @@ } override fun showRegistView() { + showOverlayBannerAd() if (moveOverlayView.isShown) { windowManager.removeView(moveOverlayView) }