KMMAdmob

Enables seamless integration of Google AdMob advertisements into Android and iOS apps using a unified codebase. Offers simplified display of various ad formats with minimal configuration.

Android
iOS
GitHub stars1
Dependents0
Creation datealmost 2 years ago

Last activityalmost 2 years ago
Latest release1.0.0 (almost 2 years ago)

KAdmob


KAdmob is a Kotlin Multiplatform Mobile (KMM) library that enables seamless integration of Google AdMob advertisements in Android and iOS applications using a unified codebase. It provides a simplified interface for displaying banner ads, interstitial ads, and rewarded video ads across both platforms with minimal configuration


Maven Central

KAdmob is available on mavenCentral().

Install

implementation("io.github.the-best-is-best:kadmob:1.0.1")

Need add this in pod file if not exist run pod init

  pod 'KAdmob' , '0.1.2'

How to use it

First in iosApp

GADMobileAds.sharedInstance().start(completionHandler: nil)

Second in androidMain

        AndroidKAdmob.initialization(this)

in commonMain

init unit ads id

  val interstitialAd = KAdmobInterstitialAd()
interstitialAd.loadInterstitialAd("ca-app-pub-7284367511062855/1974850970")

val rewardAd = KAdmobRewardedAd()
rewardAd.loadRewardedAd("ca-app-pub-3940256099942544/1712485313")

val rewardedInterstitialAd = KAdmobRewardedInterstitialAd()
rewardedInterstitialAd.loadRewardedInterstitialAd("ca-app-pub-3940256099942544/6978759866")

show ad

 ElevatedButton(onClick = {
    interstitialAd.showInterstitialAd()
}) {
    Text("InterstitialAd")
}
ElevatedButton(onClick = {
    rewardAd.show(reloadAd) {
        it.onSuccess {
            println("reward is $it")
        }
    }
}) {
    Text("rewardAd")
}
ElevatedButton(onClick = {
    rewardedInterstitialAd.show(reloadAd) {
        it.onSuccess {
            println("rewardedInterstitialAd is $it")
        }
    }
}) {
    Text("rewardedInterstitialAd")
}
KBannerAd(
    modifier = Modifier
        .fillMaxWidth()
        .height(150.dp),
    type = KAdmobBannerType.LARGE_BANNER,
    adUnitId = "ca-app-pub-3940256099942544/6300978111" // Test ID
)
Android
iOS
GitHub stars1
Dependents0
Creation datealmost 2 years ago

Last activityalmost 2 years ago
Latest release1.0.0 (almost 2 years ago)

KAdmob


KAdmob is a Kotlin Multiplatform Mobile (KMM) library that enables seamless integration of Google AdMob advertisements in Android and iOS applications using a unified codebase. It provides a simplified interface for displaying banner ads, interstitial ads, and rewarded video ads across both platforms with minimal configuration


Maven Central

KAdmob is available on mavenCentral().

Install

implementation("io.github.the-best-is-best:kadmob:1.0.1")

Need add this in pod file if not exist run pod init

  pod 'KAdmob' , '0.1.2'

How to use it

First in iosApp

GADMobileAds.sharedInstance().start(completionHandler: nil)

Second in androidMain

        AndroidKAdmob.initialization(this)

in commonMain

init unit ads id

  val interstitialAd = KAdmobInterstitialAd()
interstitialAd.loadInterstitialAd("ca-app-pub-7284367511062855/1974850970")

val rewardAd = KAdmobRewardedAd()
rewardAd.loadRewardedAd("ca-app-pub-3940256099942544/1712485313")

val rewardedInterstitialAd = KAdmobRewardedInterstitialAd()
rewardedInterstitialAd.loadRewardedInterstitialAd("ca-app-pub-3940256099942544/6978759866")

show ad

 ElevatedButton(onClick = {
    interstitialAd.showInterstitialAd()
}) {
    Text("InterstitialAd")
}
ElevatedButton(onClick = {
    rewardAd.show(reloadAd) {
        it.onSuccess {
            println("reward is $it")
        }
    }
}) {
    Text("rewardAd")
}
ElevatedButton(onClick = {
    rewardedInterstitialAd.show(reloadAd) {
        it.onSuccess {
            println("rewardedInterstitialAd is $it")
        }
    }
}) {
    Text("rewardedInterstitialAd")
}
KBannerAd(
    modifier = Modifier
        .fillMaxWidth()
        .height(150.dp),
    type = KAdmobBannerType.LARGE_BANNER,
    adUnitId = "ca-app-pub-3940256099942544/6300978111" // Test ID
)