diff --git a/.gitignore b/.gitignore
index 654168d21..bf72ef375 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,6 @@ captures/
# Keystore files
*.jks
+
+# Applovin Max Ad Review plugin
+.safedk/
\ No newline at end of file
diff --git a/Example/PrebidDemoKotlin/build.gradle b/Example/PrebidDemoKotlin/build.gradle
index 932346f9c..c6d59dfba 100644
--- a/Example/PrebidDemoKotlin/build.gradle
+++ b/Example/PrebidDemoKotlin/build.gradle
@@ -1,8 +1,11 @@
apply plugin: 'com.android.application'
-
apply plugin: 'kotlin-android'
-
apply plugin: 'kotlin-android-extensions'
+apply plugin: 'applovin-quality-service'
+
+applovin {
+ apiKey "GFK71zBxyxVAos4h_nh9NHqmym-hXdJisa0oDLiZ6CpGo6TaA-C08qHDlWcvguArWJJF03h77gL4dqJ3e9ubnn"
+}
android {
compileSdkVersion 30
@@ -35,11 +38,13 @@ dependencies {
implementation project(':PrebidMobile')
implementation project(':PrebidMobile-gamEventHandlers')
implementation project(':PrebidMobile-admobAdapters')
+ implementation project(':PrebidMobile-maxAdapters')
// For testing staging releases
// implementation 'org.prebid:prebid-mobile-sdk:1.13.0-beta2'
// implementation 'org.prebid:prebid-mobile-sdk-gam-event-handlers:1.13.0-beta2'
// implementation 'org.prebid:prebid-mobile-sdk-admob-adapters:1.13.0-beta2'
+// implementation 'org.prebid:prebid-mobile-sdk-max-adapters:1.13.0-beta2'
// Standard libraries
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
@@ -48,6 +53,8 @@ dependencies {
// Advertisement
implementation 'com.google.android.gms:play-services-ads:20.4.0'
+ implementation "com.applovin:applovin-sdk:11.3.2"
+ implementation "com.google.android.gms:play-services-ads-identifier:18.0.1" // For Applovin Max
// Multidex
diff --git a/Example/PrebidDemoKotlin/src/main/AndroidManifest.xml b/Example/PrebidDemoKotlin/src/main/AndroidManifest.xml
index 4e617b452..a50fd6a84 100644
--- a/Example/PrebidDemoKotlin/src/main/AndroidManifest.xml
+++ b/Example/PrebidDemoKotlin/src/main/AndroidManifest.xml
@@ -24,21 +24,25 @@
android:theme="@style/AppTheme">
+ android:name="com.google.android.gms.ads.AD_MANAGER_APP"
+ android:value="true" />
+ android:name="com.google.android.gms.ads.APPLICATION_ID"
+ android:value="ca-app-pub-1875909575462531~6255590079" />
+
+
-
+
-
+
-
+
diff --git a/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/AdTypesRepository.kt b/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/AdTypesRepository.kt
index 7f604d358..23fd14f5b 100644
--- a/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/AdTypesRepository.kt
+++ b/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/AdTypesRepository.kt
@@ -269,6 +269,22 @@ object AdTypesRepository {
InAppAdMobNative.destroy()
}
)
+ ),
+
+ "In-App + Applovin Max" to listOf(
+ AdType(
+ "Banner",
+ onCreate = { activity, wrapper, autoRefreshTime ->
+ useTestServer()
+ PrebidMobile.setStoredAuctionResponse("response-prebid-banner-320-50")
+ InAppMaxBanner.create(
+ wrapper, autoRefreshTime / 1000,
+ "3d8a0bcbb6d571d5",
+ "imp-prebid-banner-320-50"
+ )
+ },
+ onDestroy = { InAppMaxBanner.destroy() }
+ ),
)
)
@@ -277,5 +293,4 @@ object AdTypesRepository {
PrebidMobile.setPrebidServerHost(Host.createCustomHost("https://prebid-server-test-j.prebid.org/openrtb2/auction"))
}
-
}
\ No newline at end of file
diff --git a/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/CustomApplication.kt b/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/CustomApplication.kt
index a21290cba..916163222 100644
--- a/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/CustomApplication.kt
+++ b/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/CustomApplication.kt
@@ -24,6 +24,8 @@ import android.os.Bundle
import android.util.Log
import android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
import android.webkit.WebView
+import com.applovin.sdk.AppLovinSdk
+import com.applovin.sdk.AppLovinSdkConfiguration
import com.google.android.gms.ads.MobileAds
import com.google.android.gms.ads.RequestConfiguration
@@ -35,6 +37,7 @@ class CustomApplication : Application() {
super.onCreate()
initPrebidSDK()
initAdMob()
+ initApplovinMax()
if (BuildConfig.DEBUG) {
activateKeepScreenOnFlag()
}
@@ -61,6 +64,12 @@ class CustomApplication : Application() {
MobileAds.setRequestConfiguration(configuration)
}
+ private fun initApplovinMax() {
+ AppLovinSdk.getInstance(this).mediationProvider = "max"
+ AppLovinSdk.getInstance(this).initializeSdk { configuration: AppLovinSdkConfiguration -> }
+// AppLovinSdk.getInstance(this).settings.setVerboseLogging(true);
+ }
+
private fun activateKeepScreenOnFlag() {
sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
this.registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
diff --git a/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/ads/inappmax/InAppMaxBanner.kt b/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/ads/inappmax/InAppMaxBanner.kt
new file mode 100644
index 000000000..3171c14bd
--- /dev/null
+++ b/Example/PrebidDemoKotlin/src/main/java/org/prebid/mobile/prebidkotlindemo/ads/inappmax/InAppMaxBanner.kt
@@ -0,0 +1,77 @@
+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.MaxBannerMediationUtils
+import com.applovin.mediation.adapters.PrebidMAXMediationAdapter
+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)
+ )
+ adView?.setLocalExtraParameter(PrebidMAXMediationAdapter.EXTRA_RESPONSE_ID, "Lol")
+
+ 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()
+ }
+
+ 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?) {}
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Example/PrebidDemoKotlin/src/main/res/values-sw600dp/attrs.xml b/Example/PrebidDemoKotlin/src/main/res/values-sw600dp/attrs.xml
new file mode 100644
index 000000000..f4e161252
--- /dev/null
+++ b/Example/PrebidDemoKotlin/src/main/res/values-sw600dp/attrs.xml
@@ -0,0 +1,4 @@
+
+
+ 90dp
+
\ No newline at end of file
diff --git a/Example/PrebidDemoKotlin/src/main/res/values/attrs.xml b/Example/PrebidDemoKotlin/src/main/res/values/attrs.xml
new file mode 100644
index 000000000..7705d0879
--- /dev/null
+++ b/Example/PrebidDemoKotlin/src/main/res/values/attrs.xml
@@ -0,0 +1,4 @@
+
+
+ 50dp
+
\ No newline at end of file
diff --git a/Example/PrebidInternalTestApp/build.gradle b/Example/PrebidInternalTestApp/build.gradle
index 61eab4f67..915209aff 100644
--- a/Example/PrebidInternalTestApp/build.gradle
+++ b/Example/PrebidInternalTestApp/build.gradle
@@ -87,11 +87,13 @@ dependencies {
implementation project(':PrebidMobile')
implementation project(':PrebidMobile-gamEventHandlers')
implementation project(':PrebidMobile-admobAdapters')
+ implementation project(':PrebidMobile-maxAdapters')
// For testing staging releases
// implementation 'org.prebid:prebid-mobile-sdk:1.13.0-beta2'
// implementation 'org.prebid:prebid-mobile-sdk-gam-event-handlers:1.13.0-beta2'
// implementation 'org.prebid:prebid-mobile-sdk-admob-adapters:1.13.0-beta2'
+// implementation 'org.prebid:prebid-mobile-sdk-max-adapters:1.13.0-beta2'
// Base dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
diff --git a/Example/PrebidInternalTestApp/src/main/java/org/prebid/mobile/renderingtestapp/data/DemoItem.kt b/Example/PrebidInternalTestApp/src/main/java/org/prebid/mobile/renderingtestapp/data/DemoItem.kt
index 410dcde92..f03b13302 100644
--- a/Example/PrebidInternalTestApp/src/main/java/org/prebid/mobile/renderingtestapp/data/DemoItem.kt
+++ b/Example/PrebidInternalTestApp/src/main/java/org/prebid/mobile/renderingtestapp/data/DemoItem.kt
@@ -32,6 +32,7 @@ enum class Tag(val tagName: String) {
IN_APP("In-App"),
GAM("GAM"),
ADMOB("AdMob"),
+ MAX("Max"),
ALL("All")
}
\ No newline at end of file
diff --git a/Example/PrebidInternalTestApp/src/main/res/values/arrays.xml b/Example/PrebidInternalTestApp/src/main/res/values/arrays.xml
index 17f9b5fa4..176791e87 100644
--- a/Example/PrebidInternalTestApp/src/main/res/values/arrays.xml
+++ b/Example/PrebidInternalTestApp/src/main/res/values/arrays.xml
@@ -29,6 +29,7 @@
- @string/segment_title_in_app
- @string/segment_title_gam
- @string/segment_title_admob
+ - @string/segment_title_max
- @string/segment_title_all
@@ -40,5 +41,6 @@
All
GAM
AdMob
+ Max
In-App
\ No newline at end of file
diff --git a/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/ParametersMatcher.java b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/ParametersMatcher.java
new file mode 100644
index 000000000..60047e5db
--- /dev/null
+++ b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/ParametersMatcher.java
@@ -0,0 +1,95 @@
+package org.prebid.mobile;
+
+import android.os.Bundle;
+import androidx.annotation.Nullable;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+public class ParametersMatcher {
+
+ private static final String TAG = "ParametersMatcher";
+
+ public static boolean doParametersMatch(
+ @Nullable String serverParametersJsonString,
+ @Nullable HashMap prebidParameters
+ ) {
+ HashMap serverParameters = jsonStringToHashMap(serverParametersJsonString);
+ return doParametersMatch(serverParameters, prebidParameters);
+ }
+
+ public static boolean doParametersMatch(
+ @Nullable Bundle serverParametersBundle,
+ @Nullable HashMap prebidParameters
+ ) {
+ HashMap serverParameters = bundleToHashMap(serverParametersBundle);
+ return doParametersMatch(serverParameters, prebidParameters);
+ }
+
+ public static boolean doParametersMatch(
+ @Nullable HashMap serverParameters,
+ @Nullable HashMap prebidParameters
+ ) {
+ if (serverParameters == null || prebidParameters == null) {
+ return false;
+ }
+
+ try {
+ for (String serverKey : serverParameters.keySet()) {
+ if (prebidParameters.containsKey(serverKey)) {
+ String prebidValue = prebidParameters.get(serverKey);
+ String serverValue = serverParameters.get(serverKey);
+ if (prebidValue == null || !prebidValue.equals(serverValue)) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ return true;
+ } catch (NullPointerException e) {
+ LogUtil.error(TAG, "Null pointer exception");
+ }
+ return false;
+ }
+
+ @Nullable
+ private static HashMap bundleToHashMap(@Nullable Bundle bundle) {
+ if (bundle == null) {
+ return null;
+ }
+
+ HashMap parameters = new HashMap<>();
+ for (String bundleKey : bundle.keySet()) {
+ String bundleValue = bundle.getString(bundleKey);
+ if (bundleValue != null) {
+ parameters.put(bundleKey, bundleValue);
+ }
+ }
+ return parameters;
+ }
+
+ @Nullable
+ private static HashMap jsonStringToHashMap(@Nullable String jsonString) {
+ if (jsonString == null || jsonString.trim().length() == 0) {
+ return null;
+ }
+
+ try {
+ JSONObject root = new JSONObject(jsonString);
+ HashMap parameters = new HashMap<>();
+ Iterator keys = root.keys();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ parameters.put(key, root.getString(key));
+ }
+ return parameters;
+ } catch (JSONException e) {
+ LogUtil.error(TAG, "Can't parse parameters");
+ return null;
+ }
+ }
+
+}
diff --git a/PrebidMobile/PrebidMobile-maxAdapters/build.gradle b/PrebidMobile/PrebidMobile-maxAdapters/build.gradle
new file mode 100644
index 000000000..52b7343ca
--- /dev/null
+++ b/PrebidMobile/PrebidMobile-maxAdapters/build.gradle
@@ -0,0 +1,8 @@
+apply from: '../android.gradle'
+apply from: '../publisher.gradle'
+apply from: '../tests.gradle'
+
+dependencies {
+ implementation project(":PrebidMobile")
+ implementation "com.applovin:applovin-sdk:11.3.2"
+}
diff --git a/PrebidMobile/PrebidMobile-maxAdapters/proguard-rules.pro b/PrebidMobile/PrebidMobile-maxAdapters/proguard-rules.pro
new file mode 100644
index 000000000..e69de29bb
diff --git a/PrebidMobile/PrebidMobile-maxAdapters/src/main/AndroidManifest.xml b/PrebidMobile/PrebidMobile-maxAdapters/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..012e58767
--- /dev/null
+++ b/PrebidMobile/PrebidMobile-maxAdapters/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+
diff --git a/PrebidMobile/PrebidMobile-maxAdapters/src/main/java/com/applovin/mediation/adapters/MaxBannerMediationUtils.java b/PrebidMobile/PrebidMobile-maxAdapters/src/main/java/com/applovin/mediation/adapters/MaxBannerMediationUtils.java
new file mode 100644
index 000000000..b31306a36
--- /dev/null
+++ b/PrebidMobile/PrebidMobile-maxAdapters/src/main/java/com/applovin/mediation/adapters/MaxBannerMediationUtils.java
@@ -0,0 +1,56 @@
+package com.applovin.mediation.adapters;
+
+import android.util.Log;
+import androidx.annotation.Nullable;
+import com.applovin.mediation.ads.MaxAdView;
+import org.prebid.mobile.LogUtil;
+import org.prebid.mobile.rendering.bidding.data.bid.BidResponse;
+import org.prebid.mobile.rendering.bidding.display.PrebidMediationDelegate;
+import org.prebid.mobile.rendering.models.internal.VisibilityTrackerOption;
+import org.prebid.mobile.rendering.models.ntv.NativeEventTracker;
+import org.prebid.mobile.rendering.utils.helpers.VisibilityChecker;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+
+public class MaxBannerMediationUtils implements PrebidMediationDelegate {
+
+ private static final String TAG = MaxBannerMediationUtils.class.getSimpleName();
+
+ private final WeakReference adViewReference;
+
+ public MaxBannerMediationUtils(MaxAdView adView) {
+ adViewReference = new WeakReference<>(adView);
+ }
+
+ @Override
+ public void setResponseToLocalExtras(@Nullable BidResponse response) {
+ if (response != null && adViewReference.get() != null) {
+ adViewReference.get().setLocalExtraParameter(PrebidMAXMediationAdapter.EXTRA_RESPONSE_ID, response.getId());
+ }
+ }
+
+ @Override
+ public boolean canPerformRefresh() {
+ MaxAdView view = adViewReference.get();
+ if (view == null) {
+ LogUtil.error(TAG, "AdView is null, it can be destroyed as WeakReference");
+ return false;
+ }
+
+ final VisibilityTrackerOption visibilityTrackerOption = new VisibilityTrackerOption(NativeEventTracker.EventType.IMPRESSION);
+ final VisibilityChecker checker = new VisibilityChecker(visibilityTrackerOption);
+
+ boolean isVisible = checker.isVisibleForRefresh(view);
+ if (isVisible) {
+ Log.d(TAG, "Visibility checker result: " + true);
+ } else {
+ Log.e(TAG, "Can't perform refresh. Ad view is not visible.");
+ }
+ return true;
+ }
+
+ @Override
+ public void handleKeywordsUpdate(@Nullable HashMap keywords) {}
+
+}
diff --git a/PrebidMobile/PrebidMobile-maxAdapters/src/main/java/com/applovin/mediation/adapters/PrebidMAXMediationAdapter.java b/PrebidMobile/PrebidMobile-maxAdapters/src/main/java/com/applovin/mediation/adapters/PrebidMAXMediationAdapter.java
new file mode 100644
index 000000000..d549c4388
--- /dev/null
+++ b/PrebidMobile/PrebidMobile-maxAdapters/src/main/java/com/applovin/mediation/adapters/PrebidMAXMediationAdapter.java
@@ -0,0 +1,149 @@
+package com.applovin.mediation.adapters;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import com.applovin.mediation.MaxAdFormat;
+import com.applovin.mediation.adapter.MaxAdViewAdapter;
+import com.applovin.mediation.adapter.MaxAdapterError;
+import com.applovin.mediation.adapter.listeners.MaxAdViewAdapterListener;
+import com.applovin.mediation.adapter.parameters.MaxAdapterInitializationParameters;
+import com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters;
+import com.applovin.sdk.AppLovinSdk;
+import org.prebid.mobile.LogUtil;
+import org.prebid.mobile.ParametersMatcher;
+import org.prebid.mobile.PrebidMobile;
+import org.prebid.mobile.rendering.bidding.data.bid.BidResponse;
+import org.prebid.mobile.rendering.bidding.display.BidResponseCache;
+import org.prebid.mobile.rendering.bidding.display.DisplayView;
+import org.prebid.mobile.rendering.bidding.listeners.DisplayViewListener;
+import org.prebid.mobile.rendering.errors.AdException;
+import org.prebid.mobile.units.configuration.AdFormat;
+import org.prebid.mobile.units.configuration.AdUnitConfiguration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class PrebidMAXMediationAdapter extends MediationAdapterBase implements MaxAdViewAdapter {
+
+ public static final String TAG = PrebidMAXMediationAdapter.class.getSimpleName();
+ public static final String EXTRA_RESPONSE_ID = TAG + "ExtraResponseId";
+
+ private DisplayView adView;
+
+ public PrebidMAXMediationAdapter(AppLovinSdk appLovinSdk) {
+ super(appLovinSdk);
+ }
+
+ @Override
+ public void initialize(
+ MaxAdapterInitializationParameters maxAdapterInitializationParameters,
+ Activity activity,
+ OnCompletionListener onCompletionListener
+ ) {
+ Log.d(TAG, "Initializing");
+ onCompletionListener.onCompletion(InitializationStatus.INITIALIZING, null);
+ PrebidMobile.setApplicationContext(activity.getApplicationContext(), () -> {
+ onCompletionListener.onCompletion(InitializationStatus.INITIALIZED_SUCCESS, null);
+ });
+ }
+
+ /**
+ * Loads Banner ad.
+ */
+ @Override
+ public void loadAdViewAd(
+ MaxAdapterResponseParameters parameters,
+ MaxAdFormat maxAdFormat,
+ Activity activity,
+ MaxAdViewAdapterListener maxListener
+ ) {
+ if (parameters == null || parameters.getCustomParameters() == null || parameters.getLocalExtraParameters() == null) {
+ String error = "Parameters are empty!";
+ maxListener.onAdViewAdLoadFailed(new MaxAdapterError(1001, error));
+ return;
+ }
+
+ Bundle serverParameters = parameters.getCustomParameters();
+ Map extras = parameters.getLocalExtraParameters();
+ if (!extras.containsKey(EXTRA_RESPONSE_ID) || !(extras.get(EXTRA_RESPONSE_ID) instanceof String)) {
+ String error = "Response id is null";
+ maxListener.onAdViewAdLoadFailed(new MaxAdapterError(1002, error));
+ return;
+ }
+
+ String responseId = (String) extras.get(EXTRA_RESPONSE_ID);
+ HashMap prebidParameters = BidResponseCache.getInstance().getKeywords(responseId);
+ if (!ParametersMatcher.doParametersMatch(serverParameters, prebidParameters)) {
+ String error = "Parameters don't match";
+ maxListener.onAdViewAdLoadFailed(new MaxAdapterError(1003, error));
+ return;
+ }
+
+ BidResponse response = BidResponseCache.getInstance().popBidResponse(responseId);
+ if (response == null) {
+ String error = "There's no response for id: " + responseId;
+ maxListener.onAdViewAdLoadFailed(new MaxAdapterError(1004, error));
+ return;
+ }
+
+ AdUnitConfiguration adConfiguration = new AdUnitConfiguration();
+ adConfiguration.setAdFormat(AdFormat.BANNER);
+ DisplayViewListener listener = getListener(maxListener);
+
+ if (activity != null) {
+ LogUtil.info(TAG, "Prebid ad won: " + parameters.getThirdPartyAdPlacementId());
+ activity.runOnUiThread(() -> {
+ adView = new DisplayView(activity, listener, adConfiguration, response);
+ });
+ } else {
+ String error = "Activity is null";
+ maxListener.onAdViewAdLoadFailed(new MaxAdapterError(1005, error));
+ }
+ }
+
+ @Override
+ public String getSdkVersion() {
+ return PrebidMobile.SDK_VERSION;
+ }
+
+ @Override
+ public String getAdapterVersion() {
+ return "1.15.0-beta1";
+ }
+
+ @Override
+ public void onDestroy() {}
+
+ private DisplayViewListener getListener(MaxAdViewAdapterListener maxListener) {
+ return new DisplayViewListener() {
+ @Override
+ public void onAdLoaded() {
+ maxListener.onAdViewAdLoaded(adView);
+ }
+
+ @Override
+ public void onAdDisplayed() {
+ maxListener.onAdViewAdDisplayed();
+ }
+
+ @Override
+ public void onAdFailed(AdException exception) {
+ maxListener.onAdViewAdDisplayFailed(new MaxAdapterError(1005, "Ad failed: " + exception.getMessage()));
+ }
+
+ @Override
+ public void onAdClicked() {
+ maxListener.onAdViewAdClicked();
+ maxListener.onAdViewAdExpanded();
+ }
+
+ @Override
+ public void onAdClosed() {
+ maxListener.onAdViewAdCollapsed();
+ maxListener.onAdViewAdHidden();
+ }
+ };
+ }
+
+}
diff --git a/build.gradle b/build.gradle
index 424862f58..d64f0091e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,13 +15,15 @@ ext {
buildscript {
ext.kotlin_version = '1.5.32'
repositories {
- mavenCentral()
google()
+ mavenCentral()
+ maven { url 'https://artifacts.applovin.com/android' } // For Applovin Max Ad Review
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "com.applovin.quality:AppLovinQualityServiceGradlePlugin:4.3.9"
}
}
diff --git a/scripts/Maven/PrebidMobile-maxAdapters-pom.xml b/scripts/Maven/PrebidMobile-maxAdapters-pom.xml
new file mode 100644
index 000000000..52281502c
--- /dev/null
+++ b/scripts/Maven/PrebidMobile-maxAdapters-pom.xml
@@ -0,0 +1,65 @@
+
+
+ 4.0.0
+ org.prebid
+ prebid-mobile-sdk-max-adapters
+ 1.13.0-beta2
+
+ jar
+ Prebid Mobile Android SDK
+ Prebid Mobile
+ https://www.prebid.org
+
+
+ scm:git:git@github.com:prebid/prebid-mobile-android.git
+ scm:git:git@github.com:prebid/prebid-mobile-android.git
+ git@github.com:prebid/prebid-mobile-android.git
+
+
+
+
+ The Apache License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+
+
+ Postindustria AdTech Team
+ hello@postindustria.com
+ Postindustria LTD
+ https://postindustria.com/
+
+
+
+ AppNexus Mobile Team
+ sdk@appnexus.com
+ AppNexus, Inc.
+ http://www.appnexus.com
+
+
+
+ RubiconProject Mobile Team
+ sdk@https://rubiconproject.com/
+ The Rubicon Project, Inc.
+ https://rubiconproject.com
+
+
+
+
+
+ org.prebid
+ prebid-mobile-sdk
+ 1.13.0-beta2
+ compile
+
+
+ com.applovin
+ applovin-sdk
+ 11.3.2
+ compile
+
+
+
diff --git a/scripts/Maven/deployPrebidMobile.sh b/scripts/Maven/deployPrebidMobile.sh
index 5a6634e0f..85f7db986 100755
--- a/scripts/Maven/deployPrebidMobile.sh
+++ b/scripts/Maven/deployPrebidMobile.sh
@@ -40,9 +40,8 @@ sh ./buildPrebidMobile.sh
cp -r ../generated/* "$DEPLOY_DIR_ABSOLUTE" || true
-modules=("PrebidMobile" "PrebidMobile-core" "PrebidMobile-gamEventHandlers" "PrebidMobile-admobAdapters")
-
-extensions=("jar" "aar" "jar" "jar")
+modules=("PrebidMobile" "PrebidMobile-core" "PrebidMobile-gamEventHandlers" "PrebidMobile-admobAdapters" "PrebidMobile-maxAdapters")
+extensions=("jar" "aar" "jar" "jar" "jar")
for n in ${!modules[@]}; do
echo -e "\n"
echoX "Deploying ${modules[$n]} on Maven..."
diff --git a/scripts/buildPrebidMobile.sh b/scripts/buildPrebidMobile.sh
index 043dd6afa..870be9c16 100755
--- a/scripts/buildPrebidMobile.sh
+++ b/scripts/buildPrebidMobile.sh
@@ -80,6 +80,7 @@ modules=(
"PrebidMobile-core"
"PrebidMobile-gamEventHandlers"
"PrebidMobile-admobAdapters"
+ "PrebidMobile-maxAdapters"
)
projectPaths=(
@@ -87,6 +88,7 @@ projectPaths=(
"$BASEDIR/PrebidMobile/PrebidMobile-core"
"$BASEDIR/PrebidMobile/PrebidMobile-gamEventHandlers"
"$BASEDIR/PrebidMobile/PrebidMobile-admobAdapters"
+ "$BASEDIR/PrebidMobile/PrebidMobile-maxAdapters"
)
mkdir "$OUTDIR/aar"
diff --git a/scripts/testPrebidMobile.sh b/scripts/testPrebidMobile.sh
index 16db4dbd5..3b4fd874e 100755
--- a/scripts/testPrebidMobile.sh
+++ b/scripts/testPrebidMobile.sh
@@ -18,6 +18,7 @@ echoX "clean previous build"
./gradlew clean
echoX "start unit tests"
-./gradlew PrebidMobile-core:testDebugUnitTest
-./gradlew PrebidMobile-gamEventHandlers:testDebugUnitTest
-./gradlew PrebidMobile-admobAdapters:testDebugUnitTest
\ No newline at end of file
+./gradlew -q PrebidMobile-core:testDebugUnitTest
+./gradlew -q PrebidMobile-gamEventHandlers:testDebugUnitTest
+./gradlew -q PrebidMobile-admobAdapters:testDebugUnitTest
+./gradlew -q PrebidMobile-maxAdapters:testDebugUnitTest
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 66620331b..35b2a3472 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -2,6 +2,7 @@ include ':PrebidMobile',
':PrebidMobile-core',
':PrebidMobile-gamEventHandlers',
':PrebidMobile-admobAdapters',
+ ':PrebidMobile-maxAdapters',
':test-utils',
':omsdk-android',
// Prebid Demo apps
@@ -16,6 +17,7 @@ project(':PrebidMobile').projectDir = new File('PrebidMobile')
project(':PrebidMobile-core').projectDir = new File('PrebidMobile/PrebidMobile-core')
project(':PrebidMobile-gamEventHandlers').projectDir = new File('PrebidMobile/PrebidMobile-gamEventHandlers')
project(':PrebidMobile-admobAdapters').projectDir = new File('PrebidMobile/PrebidMobile-admobAdapters')
+project(':PrebidMobile-maxAdapters').projectDir = new File('PrebidMobile/PrebidMobile-maxAdapters')
project(':omsdk-android').projectDir = new File('PrebidMobile/omsdk-android')
project(':test-utils').projectDir = new File('PrebidMobile/test-utils')