Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Adapters/Yandex/ISYandexAdapter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

ext {
adapterVersion = '4.3.0'
adapterVersion = '4.3.0' // We recommend using the version based on the Yandex SDK version like '7.0.1.0' or '7.0.1'
}

def getGitHash = { ->
Expand Down Expand Up @@ -71,5 +71,3 @@ task createAAR(type: Copy,group:'buildTasks') {
fileName.replace('release', adapterVersion)
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class YandexAdapter(providerName: String) : AbstractAdapter(providerName),
private const val GitHash: String = BuildConfig.GitHash

// Yandex keys
private const val MEDIATION_NAME: String = "ironSource"
private const val MEDIATION_NAME: String = "ironSource" // We recommend using only lowercase like "ironsource"
private const val APP_ID_KEY: String = "appId"
private const val AD_UNIT_ID_KEY: String = "adUnitId"

Expand Down Expand Up @@ -157,10 +157,18 @@ class YandexAdapter(providerName: String) : AbstractAdapter(providerName),
MobileAds.setUserConsent(consent)
}

override fun setMetaData(p0: String?, p1: MutableList<String>?) {
super.setMetaData(p0, p1)
// Yandex SDK supports COPPA using MobileAds::setAgeRestrictedUser
// Please use it if you have that information
}

//endregion

// region Helpers
fun collectBiddingData(biddingDataCallback: BiddingDataCallback, bidderTokenRequest: BidderTokenRequestConfiguration) {

// This check is not necessary, the SDK will be initialized automatically if it has not already been
if (mInitState != InitState.INIT_STATE_SUCCESS) {
val error = "returning null as token since init isn't completed"
IronLog.INTERNAL.verbose(error)
Expand Down Expand Up @@ -195,4 +203,4 @@ class YandexAdapter(providerName: String) : AbstractAdapter(providerName),

//endregion

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class YandexBannerAdapter (adapter: YandexAdapter) :

val adRequest: AdRequest = AdRequest.Builder()
.setBiddingData(serverData)
.setParameters(adapter.getConfigParams()) // Please pass these params in AdRequest
.build()
bannerAdView.setBannerAdEventListener(mYandexAdListener)

Expand Down Expand Up @@ -215,4 +216,4 @@ class YandexBannerAdapter (adapter: YandexAdapter) :
}

//endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class YandexInterstitialAdListener(

override fun onAdImpression(impressionData: ImpressionData?) {
IronLog.ADAPTER_CALLBACK.verbose()
// Yandex SDK provide ::onAdShown callback for the ad opening event
// Is this actually the correct place to call ::onInterstitialAdOpened and ::onInterstitialAdShowSucceeded?
mListener.onInterstitialAdOpened()
mListener.onInterstitialAdShowSucceeded()
}
Expand All @@ -67,4 +69,4 @@ class YandexInterstitialAdListener(
mListener.onInterstitialAdClosed()
mAdapter.get()?.destroyInterstitialAd()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ AbstractInterstitialAdapter<YandexAdapter>(adapter) {
val adUnitIdKey = YandexAdapter.getAdUnitIdKey()
val adUnitId = getConfigStringValueFromKey(config, adUnitIdKey)

// If a single adapter instance is used for multiple ad requests
// a loader can be created only once to improve performance
val interstitialAdLoader = InterstitialAdLoader(ContextProvider.getInstance().applicationContext).apply {
setAdLoadListener(mYandexAdListener)
}
Expand All @@ -110,6 +112,7 @@ AbstractInterstitialAdapter<YandexAdapter>(adapter) {

val adRequest: AdRequestConfiguration = AdRequestConfiguration.Builder(adUnitId)
.setBiddingData(serverData)
.setParameters(adapter.getConfigParams()) // Please pass these params in AdRequestConfiguration
.build()

postOnUIThread {
Expand Down Expand Up @@ -183,4 +186,4 @@ AbstractInterstitialAdapter<YandexAdapter>(adapter) {
//endregion


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class YandexRewardedVideoAdListener (

override fun onAdImpression(impressionData: ImpressionData?) {
IronLog.ADAPTER_CALLBACK.verbose()
// Yandex SDK provide ::onAdShown callback for the ad opening event
// Is this actually the correct place to call ::onRewardedVideoAdOpened and :: onRewardedVideoAdStarted?
mListener.onRewardedVideoAdOpened()
mListener.onRewardedVideoAdStarted()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) :

val adUnitIdKey = YandexAdapter.getAdUnitIdKey()
val adUnitId = config.optString(adUnitIdKey)

// If a single adapter instance is used for multiple ad requests
// a loader can be created only once to improve performance
val rewardedVideoAdLoader = RewardedAdLoader(ContextProvider.getInstance().applicationContext).apply {
setAdLoadListener(mYandexAdListener)
}
Expand All @@ -110,6 +113,7 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) :

val adRequest: AdRequestConfiguration = AdRequestConfiguration.Builder(adUnitId)
.setBiddingData(serverData)
.setParameters(adapter.getConfigParams()) // Please pass these params in AdRequestConfiguration
.build()

postOnUIThread {
Expand Down Expand Up @@ -156,6 +160,7 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) :

override fun releaseMemory(adUnit: IronSource.AD_UNIT, config: JSONObject?) {
IronLog.INTERNAL.verbose("adUnit = $adUnit")
// Is this check only required for RewardedVideo? Why it absent in other formats?
if (adUnit == IronSource.AD_UNIT.REWARDED_VIDEO) {
destroyRewardedVideoAd()
mYandexAdListener = null
Expand Down Expand Up @@ -184,4 +189,4 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) :
//endregion


}
}