RCAdMob

object RCAdMob

Main entry point for loading AdMob ads with automatic RevenueCat ad-event tracking.

All methods are static and annotated with @JvmStatic and @JvmOverloads so they can be called naturally from both Kotlin and Java:

// Kotlin
RCAdMob.loadAndTrackInterstitialAd(context, adUnitId, adRequest, placement = "home")
// Java
RCAdMob.loadAndTrackInterstitialAd(context, adUnitId, adRequest);
RCAdMob.loadAndTrackInterstitialAd(context, adUnitId, adRequest, "home");

For Kotlin banner ads, an extension function AdView.loadAndTrackAd is also available for more idiomatic syntax.

Functions

Link copied to clipboard
fun loadAndTrackAppOpenAd(context: Context, adUnitId: String, adRequest: AdRequest, placement: String? = null, loadCallback: AppOpenAd.AppOpenAdLoadCallback? = null, fullScreenContentCallback: FullScreenContentCallback? = null, onPaidEventListener: OnPaidEventListener? = null)

Loads an AppOpenAd and automatically tracks RevenueCat ad events.

Link copied to clipboard
fun loadAndTrackBannerAd(adView: AdView, adRequest: AdRequest, placement: String? = null, adListener: AdListener? = null, onPaidEventListener: OnPaidEventListener? = null)

Sets up RevenueCat ad-event tracking for the given AdView and loads the ad.

Link copied to clipboard
fun loadAndTrackInterstitialAd(context: Context, adUnitId: String, adRequest: AdRequest, placement: String? = null, loadCallback: InterstitialAdLoadCallback? = null, fullScreenContentCallback: FullScreenContentCallback? = null, onPaidEventListener: OnPaidEventListener? = null)

Loads an InterstitialAd and automatically tracks RevenueCat ad events.

Link copied to clipboard
fun loadAndTrackNativeAd(context: Context, adUnitId: String, adRequest: AdRequest, placement: String? = null, nativeAdOptions: NativeAdOptions? = null, adListener: AdListener? = null, onPaidEventListener: OnPaidEventListener? = null, onAdLoaded: (NativeAd) -> Unit = {}): AdLoader

Loads a native ad with automatic RevenueCat ad event tracking.

Link copied to clipboard
fun loadAndTrackRewardedAd(context: Context, adUnitId: String, adRequest: AdRequest, placement: String? = null, loadCallback: RewardedAdLoadCallback? = null, fullScreenContentCallback: FullScreenContentCallback? = null, onPaidEventListener: OnPaidEventListener? = null)

Loads a RewardedAd and automatically tracks RevenueCat ad events.

Link copied to clipboard
fun loadAndTrackRewardedInterstitialAd(context: Context, adUnitId: String, adRequest: AdRequest, placement: String? = null, loadCallback: RewardedInterstitialAdLoadCallback? = null, fullScreenContentCallback: FullScreenContentCallback? = null, onPaidEventListener: OnPaidEventListener? = null)

Loads a RewardedInterstitialAd and automatically tracks RevenueCat ad events.