-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Applovin MAX adapters (#421)
* Create Applovin Max banner adapter and configure environment (#416) * feat(max-adapters): create max adapters module #401 * feat(max-adapters): add max page into Internal test app #401 * feat(max-adapters): connect banner example to Kotlin app #401 * feat(max-adapters): create max banner adapter #401 * Create interstitial and rewarded MAX adapters (#418) * feat(max-adapters): create interstitial and rewarded adapters #404, #405 Add examples to Kotlin app. * feat(max-adapters): move listeners to different files #404, #405 * Create native MAX adapter and change architecture (#419) * feat(max-adapters): create native adapter #406 Add example to native app. * feat(max-adapters): change max adapters architecture Move files to packages. Create managers for separating different ad types logic. * feat(max-adapters): use unified parameters matcher * feat(max-adapters): create tests for ParametersChecker * feat(max-adapters): use unified name convention for adapters * feat(max-adapters): fix tests * Add MAX examples to internal test app (#420) * feat(max-adapters): add MREC example to Kotlin app #407 * feat(max-adapters): remove applovin ad review gradle plugin * feat(max-adapters): add banner examples to Internal test app #407 * feat(max-adapters): add interstitial and rewarded examples to Internal test app #404, #405 Add cleaning response id. Fix not correct check for ad type in MaxInterstitialManager. Add rewarded callbacks. * feat(max-adapters): add native examples to Internal test app #406 * feat(max-adapters): fix kotlin app dependencies
- Loading branch information
1 parent
7962804
commit fa0872b
Showing
72 changed files
with
3,541 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,6 @@ captures/ | |
|
||
# Keystore files | ||
*.jks | ||
|
||
# Applovin Max Ad Review plugin | ||
.safedk/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...emoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/ads/inappmax/InAppMaxBanner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.prebid.mobile.prebidkotlindemo.ads.inappmax | ||
|
||
import android.util.Log | ||
import android.view.ViewGroup | ||
import android.widget.FrameLayout | ||
import com.applovin.mediation.MaxAd | ||
import com.applovin.mediation.MaxAdViewAdListener | ||
import com.applovin.mediation.MaxError | ||
import com.applovin.mediation.adapters.prebid.utils.MaxBannerMediationUtils | ||
import com.applovin.mediation.ads.MaxAdView | ||
import org.prebid.mobile.AdSize | ||
import org.prebid.mobile.prebidkotlindemo.R | ||
import org.prebid.mobile.rendering.bidding.display.MediationBannerAdUnit | ||
|
||
object InAppMaxBanner { | ||
|
||
private const val TAG = "InAppMaxBanner" | ||
|
||
private var adView: MaxAdView? = null | ||
private var adUnit: MediationBannerAdUnit? = null | ||
|
||
fun create( | ||
wrapper: ViewGroup, | ||
autoRefreshTime: Int, | ||
adUnitId: String, | ||
configId: String | ||
) { | ||
adView = MaxAdView(adUnitId, wrapper.context) | ||
adView?.setListener(createListener()) | ||
adView?.layoutParams = FrameLayout.LayoutParams( | ||
ViewGroup.LayoutParams.MATCH_PARENT, | ||
wrapper.context.resources.getDimensionPixelSize(R.dimen.banner_height) | ||
) | ||
wrapper.addView(adView) | ||
|
||
val mediationUtils = MaxBannerMediationUtils(adView) | ||
adUnit = MediationBannerAdUnit( | ||
wrapper.context, | ||
configId, | ||
AdSize(320, 50), | ||
mediationUtils | ||
) | ||
adUnit?.setRefreshInterval(autoRefreshTime) | ||
adUnit?.fetchDemand { | ||
adView?.loadAd() | ||
} | ||
} | ||
|
||
fun destroy() { | ||
adView?.stopAutoRefresh() | ||
adView?.destroy() | ||
|
||
adUnit?.stopRefresh() | ||
adUnit?.destroy() | ||
} | ||
|
||
private fun createListener(): MaxAdViewAdListener { | ||
return object : MaxAdViewAdListener { | ||
override fun onAdLoaded(ad: MaxAd?) { | ||
Log.d(TAG, "onAdLoaded()") | ||
} | ||
|
||
override fun onAdLoadFailed(adUnitId: String?, error: MaxError?) { | ||
Log.d(TAG, "onAdLoadFailed(): ${error?.message}") | ||
} | ||
|
||
override fun onAdHidden(ad: MaxAd?) {} | ||
override fun onAdClicked(ad: MaxAd?) {} | ||
override fun onAdExpanded(ad: MaxAd?) {} | ||
override fun onAdCollapsed(ad: MaxAd?) {} | ||
override fun onAdDisplayed(ad: MaxAd?) {} | ||
override fun onAdDisplayFailed(ad: MaxAd?, error: MaxError?) {} | ||
} | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
...lin/src/main/java/org/prebid/mobile/prebidkotlindemo/ads/inappmax/InAppMaxInterstitial.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.prebid.mobile.prebidkotlindemo.ads.inappmax | ||
|
||
import android.app.Activity | ||
import com.applovin.mediation.MaxAd | ||
import com.applovin.mediation.MaxAdListener | ||
import com.applovin.mediation.MaxError | ||
import com.applovin.mediation.adapters.prebid.utils.MaxInterstitialMediationUtils | ||
import com.applovin.mediation.ads.MaxInterstitialAd | ||
import org.prebid.mobile.rendering.bidding.display.MediationInterstitialAdUnit | ||
import org.prebid.mobile.rendering.bidding.enums.AdUnitFormat | ||
import java.util.* | ||
|
||
object InAppMaxInterstitial { | ||
|
||
private var maxInterstitialAd: MaxInterstitialAd? = null | ||
private var adUnit: MediationInterstitialAdUnit? = null | ||
|
||
fun create( | ||
activity: Activity, | ||
adUnitId: String, | ||
configId: String | ||
) { | ||
maxInterstitialAd = MaxInterstitialAd(adUnitId, activity) | ||
maxInterstitialAd?.setListener(createListener()) | ||
|
||
val mediationUtils = | ||
MaxInterstitialMediationUtils( | ||
maxInterstitialAd | ||
) | ||
adUnit = MediationInterstitialAdUnit( | ||
activity, | ||
configId, | ||
EnumSet.of(AdUnitFormat.DISPLAY), | ||
mediationUtils | ||
) | ||
adUnit?.fetchDemand { | ||
maxInterstitialAd?.loadAd() | ||
} | ||
} | ||
|
||
fun destroy() { | ||
maxInterstitialAd?.destroy() | ||
|
||
adUnit?.destroy() | ||
} | ||
|
||
private fun createListener(): MaxAdListener { | ||
return object : MaxAdListener { | ||
override fun onAdLoaded(ad: MaxAd?) { | ||
maxInterstitialAd?.showAd() | ||
} | ||
|
||
override fun onAdDisplayed(ad: MaxAd?) {} | ||
override fun onAdHidden(ad: MaxAd?) {} | ||
override fun onAdClicked(ad: MaxAd?) {} | ||
override fun onAdLoadFailed(adUnitId: String?, error: MaxError?) {} | ||
override fun onAdDisplayFailed(ad: MaxAd?, error: MaxError?) {} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.