-
Notifications
You must be signed in to change notification settings - Fork 4
Yandex Integration
The admanagekit-yandex module provides Yandex Ads SDK providers for the multi-provider waterfall system. It supports all five ad types: interstitial, banner, native, app open, and rewarded.
dependencies {
implementation "com.github.i2hammad.AdManageKit:ad-manage-kit:v4.4.1"
implementation "com.github.i2hammad.AdManageKit:ad-manage-kit-core:v4.4.1"
implementation "com.github.i2hammad.AdManageKit:ad-manage-kit-yandex:v4.4.1"
}The Yandex Mobile Ads SDK (com.yandex.android:mobileads) is included transitively.
In your Application.onCreate():
import com.i2hammad.admanagekit.yandex.YandexProviderRegistration
import com.i2hammad.admanagekit.admob.provider.AdMobProviderRegistration
import com.i2hammad.admanagekit.core.ad.AdProviderConfig
import com.i2hammad.admanagekit.core.ad.AdUnitMapping
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
// ... existing AdManageKitConfig setup ...
// Initialize Yandex SDK
YandexProviderRegistration.initialize(this)
// Create providers
val admob = AdMobProviderRegistration.create()
val yandex = YandexProviderRegistration.create()
// Map your AdMob IDs to Yandex equivalents
AdUnitMapping.register("ca-app-pub-xxx/your-interstitial", mapOf(
"yandex" to "R-M-XXXXXX-Y"
))
AdUnitMapping.register("ca-app-pub-xxx/your-native", mapOf(
"yandex" to "R-M-XXXXXX-Y"
))
// ... register all ad units ...
// Set provider chains (AdMob primary, Yandex fallback)
AdProviderConfig.setInterstitialChain(listOf(admob.interstitialProvider, yandex.interstitialProvider))
AdProviderConfig.setBannerChain(listOf(admob.bannerProvider, yandex.bannerProvider))
AdProviderConfig.setNativeChain(listOf(admob.nativeProvider, yandex.nativeProvider))
AdProviderConfig.setAppOpenChain(listOf(admob.appOpenProvider, yandex.appOpenProvider))
AdProviderConfig.setRewardedChain(listOf(admob.rewardedProvider, yandex.rewardedProvider))
}
}No other code changes needed. All existing ad loading calls will automatically fall through to Yandex when AdMob fails.
| Ad Type | Provider Class | Description |
|---|---|---|
| Interstitial | YandexInterstitialProvider |
Full-screen interstitial ads |
| Banner | YandexBannerProvider |
Adaptive banner ads |
| Native | YandexNativeProvider |
Size-aware native ads (small/medium/large) |
| App Open | YandexAppOpenProvider |
App open ads on resume |
| Rewarded | YandexRewardedProvider |
Rewarded video ads with reward callbacks |
YandexNativeProvider renders different layouts based on the NativeAdSize hint from the consumer view:
Compact single-row layout:
[Icon] [Title + Domain] [CTA Button] [i]
- Icon (40dp) + title (single line) + CTA button
- Domain text below title
- Feedback icon inline
Vertical layout without media:
[Icon] [Title ]
[Domain ]
[Body text... ]
[ CTA Button ]
[i] [Warning] [Sponsored]
- Header row: icon (48dp) + title + domain
- Body text (up to 3 lines)
- Full-width CTA button
- Required Yandex views: feedback, warning, sponsored
Full NativeBannerView template from Yandex SDK:
- Automatically renders all ad assets including media
- Uses Yandex's built-in template layout
- No custom view binding needed
| Ad Type | Test ID |
|---|---|
| Interstitial | demo-interstitial-yandex |
| Banner | demo-banner-yandex |
| Native | demo-native-content-yandex |
| App Open | demo-appopenad-yandex |
| Rewarded | demo-rewarded-yandex |
All Yandex providers automatically report paid events via the waterfall callback system. Revenue data from Yandex's ImpressionData is converted to AdKitAdValue and logged to Firebase Analytics as ad_paid_event, matching the existing AdMob revenue tracking format.
- Min SDK: 21+
- Yandex SDK Version: 7.18.1+ (included transitively)
- Kotlin: 1.7.10+
- Hardware acceleration: Required for video ads
Your ad unit ID is not registered in AdUnitMapping. Register the Yandex equivalent:
AdUnitMapping.register("your-admob-ad-unit-id", mapOf(
"yandex" to "your-yandex-ad-unit-id"
))This is a Yandex server-side issue with demo/test ad units. Ensure you have AdMob as a fallback in your chain:
AdProviderConfig.setInterstitialChain(listOf(
yandex.interstitialProvider,
admob.interstitialProvider // fallback
))Yandex SDK requires domain, feedback, warning, and sponsored views to be bound. If any are missing, bindNativeAd() throws and the ad fails to load. This is handled internally by YandexNativeProvider -- ensure you're using the latest version.
AdManageKit v3.3.4 | GitHub | API Docs | Report Issue | Buy me a coffee