From 43c420931b8404a85259a3c8999b00bf321f27b1 Mon Sep 17 00:00:00 2001 From: bekah-jaya Date: Thu, 19 Dec 2024 10:29:37 +0700 Subject: [PATCH] Admob 23.6.0 --- AlienAdsV2/build.gradle | 32 +- .../com/aliendroid/alienads/AlienGDPR.java | 66 - .../com/aliendroid/alienads/AlienNotif.java | 28 - .../com/aliendroid/alienads/AlienOpenAds.java | 75 +- .../aliendroid/alienads/AliendroidBanner.java | 3452 +------------- .../alienads/AliendroidInitialize.java | 358 +- .../alienads/AliendroidIntertitial.java | 1136 +---- .../alienads/AliendroidMediumBanner.java | 3040 +----------- .../aliendroid/alienads/AliendroidNative.java | 4169 ++++------------- .../aliendroid/alienads/AliendroidReward.java | 2735 ++--------- .../aliendroid/alienads/ApplovinOpenAds.java | 66 +- .../aliendroid/alienads/JamboxOpenAds.java | 70 +- .../aliendroid/alienads/MyApplication.java | 3 - .../com/aliendroid/alienads/PropsOpenAds.java | 74 +- .../config/AppLovinCustomEventBanner.java | 168 - .../AppLovinCustomEventInterstitial.java | 261 -- local.properties | 4 +- 17 files changed, 1552 insertions(+), 14185 deletions(-) delete mode 100644 AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventBanner.java delete mode 100644 AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventInterstitial.java diff --git a/AlienAdsV2/build.gradle b/AlienAdsV2/build.gradle index ca9b4ed..6575ac1 100644 --- a/AlienAdsV2/build.gradle +++ b/AlienAdsV2/build.gradle @@ -31,39 +31,27 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.6.0' implementation 'androidx.lifecycle:lifecycle-process:2.6.2' - - implementation "androidx.multidex:multidex:2.0.1" - //implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') - //Main Sdk Ads - implementation 'com.google.android.gms:play-services-ads:23.3.0' - implementation 'com.facebook.android:audience-network-sdk:6.17.0' - implementation 'com.applovin:applovin-sdk:12.6.0' + implementation 'com.google.android.gms:play-services-ads:23.6.0' + implementation 'com.facebook.android:audience-network-sdk:6.18.0' implementation 'com.startapp:inapp-sdk:5.0.2' - implementation 'com.unity3d.ads:unity-ads:4.12.1' - - //Applovin - implementation 'com.applovin.mediation:facebook-adapter:6.17.0.0' - implementation 'com.applovin.mediation:google-adapter:23.2.0.0' - implementation 'com.applovin.mediation:unityads-adapter:4.12.1.0' + implementation 'com.unity3d.ads:unity-ads:4.12.5' //Admob - implementation 'com.google.ads.mediation:facebook:6.17.0.0' - implementation 'com.google.ads.mediation:applovin:12.6.0.0' - implementation 'com.google.ads.mediation:unity:4.12.2.0' + implementation 'com.google.ads.mediation:facebook:6.18.0.0' + implementation 'com.google.ads.mediation:unity:4.12.5.0' - implementation("com.google.android.ump:user-messaging-platform:3.0.0") + implementation("com.google.android.ump:user-messaging-platform:3.1.0") implementation 'com.google.android.gms:play-services-appset:16.1.0' - implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0' - implementation 'com.google.android.gms:play-services-basement:18.4.0' + implementation 'com.google.android.gms:play-services-ads-identifier:18.2.0' + implementation 'com.google.android.gms:play-services-basement:18.5.0' //startapp implementation 'com.startapp:admob-mediation:2.9.1' - implementation 'com.startapp:applovin-mediation:1.1.7' - + implementation 'com.github.ronaldwm2:alienads_propssdk:1.1.1' implementation 'com.github.bumptech.glide:glide:4.16.0' - annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1' + annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0' } \ No newline at end of file diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienGDPR.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienGDPR.java index 960692a..18c18a4 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienGDPR.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienGDPR.java @@ -1,23 +1,14 @@ package com.aliendroid.alienads; import android.app.Activity; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; import android.provider.Settings; -import androidx.annotation.Nullable; - -import com.applovin.sdk.AppLovinPrivacySettings; -import com.applovin.sdk.AppLovinSdk; -import com.applovin.sdk.AppLovinSdkConfiguration; import com.google.android.gms.ads.MobileAds; import com.google.android.ump.ConsentDebugSettings; import com.google.android.ump.ConsentForm; import com.google.android.ump.ConsentInformation; import com.google.android.ump.ConsentRequestParameters; -import com.google.android.ump.FormError; import com.google.android.ump.UserMessagingPlatform; - import com.startapp.sdk.adsbase.StartAppSDK; import java.security.MessageDigest; @@ -87,33 +78,6 @@ public static void loadGdpr(Activity activity, String selectAds, boolean childDi System.currentTimeMillis(), true); break; - case "IRON": - break; - case "APPLOVIN-M": - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - if (configuration.getConsentDialogState() == AppLovinSdkConfiguration.ConsentDialogState.APPLIES) { - // Show user consent dialog - } else if (configuration.getConsentDialogState() == AppLovinSdkConfiguration.ConsentDialogState.DOES_NOT_APPLY) { - // No need to show consent dialog, proceed with initialization - } else { - // Consent dialog state is unknown. Proceed with initialization, but check if the consent - // dialog should be shown on the next application initialization - } - } - }); - AppLovinPrivacySettings.setHasUserConsent(true, activity); - AppLovinPrivacySettings.setIsAgeRestrictedUser(childDirected, activity); - break; - case "APPLOVIN-D": - AppLovinPrivacySettings.setIsAgeRestrictedUser(childDirected, activity); - AppLovinPrivacySettings.setHasUserConsent(true, activity); - break; - case "ALIEN-M": - - break; - } } @@ -123,40 +87,12 @@ private static void initializeMobileAdsSdk(Activity activity) { } MobileAds.initialize(activity); } - - public static void loadForm(Activity activity) { - UserMessagingPlatform.loadConsentForm( - activity, - consentForm -> { - if (consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.REQUIRED) { - consentForm.show( - activity, - new ConsentForm.OnConsentFormDismissedListener() { - @Override - public void onConsentFormDismissed(@Nullable FormError formError) { - // Handle dismissal by reloading form. - loadForm(activity); - } - }); - - } - - }, - formError -> { - /// Handle Error. - } - ); - } - public static final String md5(final String s) { try { - // Create MD5 Hash MessageDigest digest = MessageDigest .getInstance("MD5"); digest.update(s.getBytes()); byte[] messageDigest = digest.digest(); - - // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i = 0; i < messageDigest.length; i++) { String h = Integer.toHexString(0xFF & messageDigest[i]); @@ -165,9 +101,7 @@ public static final String md5(final String s) { hexString.append(h); } return hexString.toString(); - } catch (NoSuchAlgorithmException e) { - //Logger.logStackTrace(TAG,e); } return ""; } diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienNotif.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienNotif.java index e7ebe8a..b75b1d5 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienNotif.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienNotif.java @@ -1,17 +1,5 @@ package com.aliendroid.alienads; - -import android.app.Application; import android.content.Context; - -/* -import com.onesignal.Continue; -import com.onesignal.OneSignal; -import com.onesignal.debug.LogLevel; - -import com.onesignal.OneSignal; - - */ - public class AlienNotif { private static String ONESIGNAL_APP_ID = ""; public static MyApplication application; @@ -23,21 +11,5 @@ public AlienNotif(Context context, MyApplication myApplication) { public static void LoadOneSignal(String apikey) { ONESIGNAL_APP_ID = apikey; - /* - OneSignal.getDebug().setLogLevel(LogLevel.VERBOSE); - OneSignal.initWithContext(context, ONESIGNAL_APP_ID); - OneSignal.getNotifications().requestPermission(true, Continue.with(r -> { - if (r.isSuccess()) { - if (r.getData()) { - } - else { - } - } - else { - - } - })); - - */ } } diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienOpenAds.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienOpenAds.java index f8e9b28..bfa851e 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienOpenAds.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienOpenAds.java @@ -14,13 +14,6 @@ import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.OnLifecycleEvent; import androidx.lifecycle.ProcessLifecycleOwner; - -import com.aliendroid.alienads.interfaces.open.OnLoadOpenAppAdmob; -import com.aliendroid.alienads.interfaces.open.OnShowOpenAppAdmob; -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxAdListener; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.ads.MaxAppOpenAd; import com.google.android.gms.ads.AdError; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.FullScreenContentCallback; @@ -119,7 +112,6 @@ public interface OnShowAdCompleteListener { public static class AppOpenAdManager { private static final String LOG_TAG = "AppOpenAdManager"; public static AppOpenAd appOpenAd = null; - public static MaxAppOpenAd appOpenAdApplovin = null; private static boolean isLoadingAd = false; static boolean isShowingAd = false; private static long loadTime = 0; @@ -158,11 +150,7 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { if (isLoadingAd || isAdAvailable()) { return; } - isLoadingAd = true; - appOpenAdApplovin = new MaxAppOpenAd(IDOPEN, context); - appOpenAdApplovin.loadAd(); - } else { if (isLoadingAd || isAdAvailable()) { return; @@ -199,14 +187,7 @@ private static boolean wasLoadTimeLessThanNHoursAgo(long numHours) { } private static boolean isAdAvailable() { - if (SELECT_ADS.equals("ADMOB")) { - return appOpenAd != null && wasLoadTimeLessThanNHoursAgo(4); - } else if (SELECT_ADS.equals("APPLOVIN-M")) { - return appOpenAdApplovin != null; - } else { - return appOpenAd != null && wasLoadTimeLessThanNHoursAgo(4); - } - + return appOpenAd != null && wasLoadTimeLessThanNHoursAgo(4); } public static void showAdIfAvailable(@NonNull final Activity activity) { @@ -261,67 +242,13 @@ public void onAdShowedFullScreenContent() { if (isShowingAd) { return; } - if (!isAdAvailable()) { Log.d(LOG_TAG, "The app open ad is not ready yet."); onShowAdCompleteListener.onShowAdComplete(); loadAd(activity); return; } - - Log.d(LOG_TAG, "Will show ad."); - appOpenAdApplovin.setListener(new MaxAdListener() { - @Override - public void onAdLoaded(MaxAd ad) { - isLoadingAd = true; - Log.d(LOG_TAG, "onAdLoaded."); - } - - @Override - public void onAdDisplayed(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdHidden(MaxAd ad) { - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - Log.d(LOG_TAG, "onAdDismissedFullScreenContent."); - } - - @Override - public void onAdClicked(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - }); - isShowingAd = true; - appOpenAdApplovin.showAd(); } else { if (isShowingAd) { return; diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidBanner.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidBanner.java index 51907ed..cfc089b 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidBanner.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidBanner.java @@ -5,32 +5,17 @@ import android.util.DisplayMetrics; import android.view.Display; import android.view.View; -import android.view.ViewGroup; -import android.widget.FrameLayout; import android.widget.RelativeLayout; import androidx.annotation.NonNull; -import com.aliendroid.alienads.config.AppLovinCustomEventBanner; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerAdmob; -import com.aliendroid.alienads.interfaces.banner.OnLoadBannerAlienMediation; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerAlienView; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerApplovinDiscovery; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerApplovinMax; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerFacebook; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerGoogle; -import com.aliendroid.alienads.interfaces.banner.OnLoadBannerIronSource; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerStartApp; -import com.aliendroid.alienads.interfaces.banner.OnLoadBannerWortise; -import com.applovin.adview.AppLovinAdView; -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxAdViewAdListener; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.ads.MaxAdView; -import com.applovin.sdk.AppLovinAd; -import com.applovin.sdk.AppLovinAdLoadListener; -import com.applovin.sdk.AppLovinAdSize; -import com.applovin.sdk.AppLovinSdkUtils; import com.facebook.ads.Ad; import com.facebook.ads.AdError; import com.google.ads.mediation.admob.AdMobAdapter; @@ -52,12 +37,9 @@ public class AliendroidBanner { - public static MaxAdView adViewMax; - public static MaxAdView jamboxBanner; public static AdView adViewAdmob; public static AdView adViewAdmob2; public static AdManagerAdView bannerGoogleAds; - public static AppLovinAdView adViewDiscovery; public static Banner startAppBanner; public static com.facebook.ads.AdView adViewFAN; public static com.facebook.ads.AdView adViewFAN2; @@ -94,31 +76,16 @@ public void onAdLoaded() { onLoadBannerAdmob.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); } break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; case "STARTAPP": if (startAppBanner != null) { startAppBanner.hideBanner(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; case "FACEBOOK": if (adViewFAN != null) { adViewFAN.destroy(); @@ -133,74 +100,6 @@ public void onAdFailedToLoad(LoadAdError adError) { onLoadBannerAdmob.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -246,38 +145,6 @@ public void onClick(View view) { bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); layAds.addView(startAppBanner, bannerParameters); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; case "FACEBOOK": adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, com.facebook.ads.AdSize.BANNER_HEIGHT_50); @@ -316,75 +183,6 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; case "ALIEN-M": PropsAdsManagement propsAds = new PropsAdsManagement(activity); AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); @@ -481,32 +279,16 @@ public void onAdLoaded() { onLoadBannerAdmob.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; case "STARTAPP": if (startAppBanner != null) { startAppBanner.hideBanner(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; case "FACEBOOK": if (adViewFAN != null) { adViewFAN.destroy(); @@ -521,74 +303,6 @@ public void onAdFailedToLoad(LoadAdError adError) { onLoadBannerAdmob.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -634,38 +348,6 @@ public void onClick(View view) { bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); layAds.addView(startAppBanner, bannerParameters); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; case "FACEBOOK": adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, com.facebook.ads.AdSize.BANNER_HEIGHT_50); @@ -704,75 +386,6 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; case "ALIEN-M": PropsAdsManagement propsAds = new PropsAdsManagement(activity); AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); @@ -863,11 +476,6 @@ public void onAdLoaded() { onLoadBannerAdmob.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); @@ -878,21 +486,11 @@ public void onAdLoaded() { startAppBanner.hideBanner(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; case "FACEBOOK": if (adViewFAN != null) { adViewFAN.destroy(); } break; - case "ALIEN-V": - if (jamboxBanner !=null){ - jamboxBanner.destroy(); - } - break; } } @@ -902,74 +500,6 @@ public void onAdFailedToLoad(LoadAdError adError) { onLoadBannerAdmob.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -1015,38 +545,6 @@ public void onClick(View view) { bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); layAds.addView(startAppBanner, bannerParameters); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; case "FACEBOOK": adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, com.facebook.ads.AdSize.BANNER_HEIGHT_50); @@ -1085,94 +583,25 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { + case "ALIEN-M": + PropsAdsManagement propsAds = new PropsAdsManagement(activity); + AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); + AdRequest adRequest2 = new AdRequest.Builder().build(); + layAds.addView(adView); + adView.loadAd(adRequest2); + break; + case "ADMOB": + AdRequest request = new AdRequest.Builder() + .build(); + adViewAdmob2 = new AdView(activity); + adViewAdmob2.setAdUnitId(idBannerBackup); + layAds.addView(adViewAdmob2); + AdSize adSizeAdmob = getAdSize(activity); + adViewAdmob2.setAdSize(adSizeAdmob); + adViewAdmob2.loadAd(request); + adViewAdmob2.setAdListener(new AdListener() { @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); - AdRequest adRequest2 = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest2); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob2 = new AdView(activity); - adViewAdmob2.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob2); - AdSize adSizeAdmob = getAdSize(activity); - adViewAdmob2.setAdSize(adSizeAdmob); - adViewAdmob2.loadAd(request); - adViewAdmob2.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { + public void onAdLoaded() { } @@ -1245,11 +674,6 @@ public void onAdLoaded() { onLoadBannerGoogle.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); @@ -1260,21 +684,11 @@ public void onAdLoaded() { startAppBanner.hideBanner(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; case "FACEBOOK": if (adViewFAN != null) { adViewFAN.destroy(); } break; - case "ALIEN-V": - if (jamboxBanner !=null){ - jamboxBanner.destroy(); - } - break; } } @@ -1284,75 +698,6 @@ public void onAdFailedToLoad(LoadAdError adError) { onLoadBannerGoogle.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -1397,37 +742,6 @@ public void onClick(View view) { bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); layAds.addView(startAppBanner, bannerParameters); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; case "FACEBOOK": adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, com.facebook.ads.AdSize.BANNER_HEIGHT_50); @@ -1466,74 +780,6 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; case "ALIEN-M": PropsAdsManagement propsAds = new PropsAdsManagement(activity); AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); @@ -1580,74 +826,6 @@ public void onError(Ad ad, AdError adError) { onLoadBannerFacebook.onError(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -1830,104 +1008,6 @@ public void onAdClosed() { } }); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; case "ALIEN-M": PropsAdsManagement propsAds = new PropsAdsManagement(activity); AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); @@ -1946,11 +1026,6 @@ public void onAdLoaded(Ad ad) { onLoadBannerFacebook.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); @@ -1971,16 +1046,6 @@ public void onAdLoaded(Ad ad) { bannerGoogleAds.destroy(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner !=null){ - jamboxBanner.destroy(); - } - break; } } @@ -2005,42 +1070,37 @@ public void onLoggingImpression(Ad ad) { public static void SmallBannerApplovinDisHPK(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup, String HPK1, String HPK2, String HPK3, String HPK4, String HPK5) { + } + + public static void SmallBannerApplovinDis(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + } + + public static void SmallBannerApplovinMax(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + + } + + public static void SmallBannerMopub(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + + } - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(HPK1).addKeyword(HPK2).addKeyword(HPK3).addKeyword(HPK4).addKeyword(HPK5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBanner); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { + public static void SmallBannerStartApp(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + Banner startAppBanner = new Banner(activity, new BannerListener() { @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); + public void onReceiveAd(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onReceiveAd(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); } break; - case "STARTAPP": - if (startAppBanner != null) { - startAppBanner.hideBanner(); - } - break; case "ADMOB": if (adViewAdmob != null) { adViewAdmob.destroy(); } break; - case "GOOGLE-ADS": if (bannerGoogleAds != null) { bannerGoogleAds.destroy(); @@ -2051,2128 +1111,15 @@ public void adReceived(AppLovinAd ad) { adViewFAN.destroy(); } break; - case "ALIEN-V": - if (jamboxBanner!=null){ - jamboxBanner.destroy(); - } - break; } } @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); + public void onFailedToReceiveAd(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onFailedToReceiveAd(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "STARTAPP": - Banner startAppBanner = new Banner(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppBanner, bannerParameters); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - AdSize adSizeAdmob = getAdSize(activity); - adViewAdmob.setAdSize(adSizeAdmob); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - AdSize adaptiveSize = getAdSize(activity); - bannerGoogleAds.setAdSize(adaptiveSize); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); - } - } - }); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.BANNER_HEIGHT_50); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); - AdRequest adRequest2 = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest2); - break; - } - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - - } - - public static void SmallBannerApplovinDis(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBanner); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "STARTAPP": - if (startAppBanner != null) { - startAppBanner.hideBanner(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner !=null){ - jamboxBanner.destroy(); - } - break; - } - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - - case "STARTAPP": - Banner startAppBanner = new Banner(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppBanner, bannerParameters); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - AdSize adSizeAdmob = getAdSize(activity); - adViewAdmob.setAdSize(adSizeAdmob); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - AdSize adaptiveSize = getAdSize(activity); - bannerGoogleAds.setAdSize(adaptiveSize); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); - } - } - }); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.BANNER_HEIGHT_50); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); - AdRequest adRequest2 = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest2); - break; - - } - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - - } - - public static void SmallBannerApplovinMax(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - - adViewMax = new MaxAdView(idBanner, activity); - - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner !=null){ - jamboxBanner.destroy(); - } - break; - case "STARTAPP": - if (startAppBanner != null) { - startAppBanner.hideBanner(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "STARTAPP": - Banner startAppBanner = new Banner(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppBanner, bannerParameters); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - AdSize adSizeAdmob = getAdSize(activity); - adViewAdmob.setAdSize(adSizeAdmob); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - AdSize adaptiveSize = getAdSize(activity); - bannerGoogleAds.setAdSize(adaptiveSize); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); - } - } - }); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.BANNER_HEIGHT_50); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); - AdRequest adRequest2 = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest2); - break; - } - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - } - - public static void SmallBannerMopub(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - - } - - public static void SmallBannerStartApp(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - Banner startAppBanner = new Banner(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner !=null){ - jamboxBanner.destroy(); - } - break; - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - } - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - AdSize adSizeAdmob = getAdSize(activity); - adViewAdmob.setAdSize(adSizeAdmob); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - AdSize adaptiveSize = getAdSize(activity); - bannerGoogleAds.setAdSize(adaptiveSize); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); - } - } - }); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.BANNER_HEIGHT_50); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); - AdRequest adRequest2 = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest2); - break; - } - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppBanner, bannerParameters); - } - - public static void SmallBannerIron(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - } - - public static void SmallBannerUnity(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - unityBanner = new BannerView(activity, idBanner, new UnityBannerSize(320, 50)); - unityBanner.load(); - layAds.addView(unityBanner); - unityBanner.setListener(new BannerView.IListener() { - @Override - public void onBannerLoaded(BannerView bannerAdView) { - switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "STARTAPP": - if (startAppBanner != null) { - startAppBanner.hideBanner(); - } - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner!=null){ - jamboxBanner.destroy(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - } - } - - @Override - public void onBannerShown(BannerView bannerAdView) { - - } - - @Override - public void onBannerClick(BannerView bannerAdView) { - - } - - @Override - public void onBannerFailedToLoad(BannerView bannerAdView, BannerErrorInfo errorInfo) { - switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "STARTAPP": - Banner startAppBanner = new Banner(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppBanner, bannerParameters); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.BANNER_HEIGHT_50); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); - AdRequest adRequest2 = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest2); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - AdSize adSizeAdmob = getAdSize(activity); - adViewAdmob.setAdSize(adSizeAdmob); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - - } - - @Override - public void onAdClicked() { - - } - - @Override - public void onAdClosed() { - - } - }); - break; - } - } - - @Override - public void onBannerLeftApplication(BannerView bannerView) { - - } - }); - } - - public static void SmallBannerAlienView(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - jamboxBanner = new MaxAdView(idBanner, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "STARTAPP": - startAppBanner.hideBanner(); - break; - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "STARTAPP": - Banner startAppBanner = new Banner(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppBanner, bannerParameters); - break; case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -4327,132 +1274,221 @@ public void onLoggingImpression(Ad ad) { } @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); + public void onImpression(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onImpression(); } - layAds.setVisibility(View.GONE); } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); + @Override + public void onClick(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onClick(); + } + } + }); + RelativeLayout.LayoutParams bannerParameters = + new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); + layAds.addView(startAppBanner, bannerParameters); } - public static void SmallBannerAlienMediation(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + public static void SmallBannerIron(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + } - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("BANNER", idBanner); - AdRequest adRequest = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest); - adView.setAdListener(new AdListener() { + public static void SmallBannerUnity(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + unityBanner = new BannerView(activity, idBanner, new UnityBannerSize(320, 50)); + unityBanner.load(); + layAds.addView(unityBanner); + unityBanner.setListener(new BannerView.IListener() { @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - super.onAdFailedToLoad(loadAdError); + public void onBannerLoaded(BannerView bannerAdView) { + switch (selectAdsBackup) { + case "STARTAPP": + if (startAppBanner != null) { + startAppBanner.hideBanner(); + } + break; + case "FACEBOOK": + if (adViewFAN != null) { + adViewFAN.destroy(); + } + break; + case "ADMOB": + if (adViewAdmob != null) { + adViewAdmob.destroy(); + } + break; + } + } + + @Override + public void onBannerShown(BannerView bannerAdView) { + + } + + @Override + public void onBannerClick(BannerView bannerAdView) { + + } + + @Override + public void onBannerFailedToLoad(BannerView bannerAdView, BannerErrorInfo errorInfo) { switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { + case "UNITY": + unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(320, 50)); + unityBanner.load(); + layAds.addView(unityBanner); + break; + case "STARTAPP": + Banner startAppBanner = new Banner(activity, new BannerListener() { @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); + public void onReceiveAd(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onReceiveAd(); } } @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); + public void onFailedToReceiveAd(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onFailedToReceiveAd(""); } layAds.setVisibility(View.GONE); - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { + @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); + public void onImpression(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onImpression(); } } @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); + public void onClick(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onClick(); } } + }); + RelativeLayout.LayoutParams bannerParameters = + new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); + layAds.addView(startAppBanner, bannerParameters); + break; + case "FACEBOOK": + adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, + com.facebook.ads.AdSize.BANNER_HEIGHT_50); + layAds.addView(adViewFAN); + com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); + public void onError(Ad ad, AdError adError) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onError(); } + layAds.setVisibility(View.GONE); + } @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); + public void onAdLoaded(Ad ad) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onAdLoaded(); } + } @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); + public void onAdClicked(Ad ad) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onAdClicked(); } } @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); + public void onLoggingImpression(Ad ad) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onLoggingImpression(); } } + }; + adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); + break; + case "ALIEN-M": + PropsAdsManagement propsAds = new PropsAdsManagement(activity); + AdView adView = propsAds.createBannerAdview("BANNER", idBannerBackup); + AdRequest adRequest2 = new AdRequest.Builder().build(); + layAds.addView(adView); + adView.loadAd(adRequest2); + break; + case "ADMOB": + AdRequest request = new AdRequest.Builder() + .build(); + adViewAdmob = new AdView(activity); + adViewAdmob.setAdUnitId(idBannerBackup); + layAds.addView(adViewAdmob); + AdSize adSizeAdmob = getAdSize(activity); + adViewAdmob.setAdSize(adSizeAdmob); + adViewAdmob.loadAd(request); + adViewAdmob.setAdListener(new AdListener() { + @Override + public void onAdLoaded() { + + } @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } + public void onAdFailedToLoad(LoadAdError adError) { layAds.setVisibility(View.GONE); + } @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); + public void onAdOpened() { + } - }; - adViewMax.setListener(listener); - final boolean isTablet = AppLovinSdkUtils.isTablet(activity); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, isTablet ? 90 : 50); - adViewMax.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); + + @Override + public void onAdClicked() { + + } + + @Override + public void onAdClosed() { + + } + }); break; + } + } + + @Override + public void onBannerLeftApplication(BannerView bannerView) { + + } + }); + } + + public static void SmallBannerAlienView(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + } + + public static void SmallBannerAlienMediation(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + + PropsAdsManagement propsAds = new PropsAdsManagement(activity); + AdView adView = propsAds.createBannerAdview("BANNER", idBanner); + AdRequest adRequest = new AdRequest.Builder().build(); + layAds.addView(adView); + adView.loadAd(adRequest); + adView.setAdListener(new AdListener() { + @Override + public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { + super.onAdFailedToLoad(loadAdError); + switch (selectAdsBackup) { case "STARTAPP": Banner startAppBanner = new Banner(activity, new BannerListener() { @Override @@ -4634,74 +1670,6 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, activity); - MaxAdViewAdListener jamboxListener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(jamboxListener); - final boolean isTabletJambox = AppLovinSdkUtils.isTablet(activity); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, isTabletJambox ? 90 : 50); - jamboxBanner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; } } @@ -4709,16 +1677,6 @@ public void onAdDisplayFailed(MaxAd ad, MaxError error) { public void onAdLoaded() { super.onAdLoaded(); switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; case "STARTAPP": startAppBanner.hideBanner(); break; diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidInitialize.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidInitialize.java index 724e3d4..5389394 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidInitialize.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidInitialize.java @@ -4,9 +4,6 @@ import android.util.Log; import com.aliendroid.alienads.config.AudienceNetworkInitializeHelper; -import com.aliendroid.sdkads.config.AppPromote; -import com.applovin.sdk.AppLovinSdk; -import com.applovin.sdk.AppLovinSdkConfiguration; import com.facebook.ads.AdSettings; import com.facebook.ads.AudienceNetworkAds; import com.google.android.gms.ads.MobileAds; @@ -20,7 +17,6 @@ import com.unity3d.ads.IUnityAdsInitializationListener; import com.unity3d.ads.UnityAds; - import java.util.Map; @@ -86,24 +82,8 @@ public void onInitializationComplete(InitializationStatus initializationStatus) } }); switch (selectAdsBackup) { - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - - } - }); - - - break; case "UNITY": - if (BuildConfig.DEBUG) { - tesMode = true; - } else { - tesMode = false; - } + tesMode = BuildConfig.DEBUG; IUnityAdsInitializationListener listener = new IUnityAdsInitializationListener() { @Override public void onInitializationComplete() { @@ -125,9 +105,6 @@ public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, S System.currentTimeMillis(), true); break; - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; case "FACEBOOK": if (!AudienceNetworkAds.isInitialized(activity)) { if (BuildConfig.DEBUG) { @@ -175,24 +152,8 @@ public void onInitializationComplete(InitializationStatus initializationStatus) } }); switch (selectAdsBackup) { - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - - } - }); - - break; case "UNITY": - if (BuildConfig.DEBUG) { - tesMode = true; - } else { - tesMode = false; - } - + tesMode = BuildConfig.DEBUG; IUnityAdsInitializationListener listener = new IUnityAdsInitializationListener() { @Override public void onInitializationComplete() { @@ -214,9 +175,6 @@ public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, S System.currentTimeMillis(), true); break; - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; case "FACEBOOK": if (!AudienceNetworkAds.isInitialized(activity)) { if (BuildConfig.DEBUG) { @@ -265,23 +223,8 @@ public void onInitializationComplete(InitializationStatus initializationStatus) } }); switch (selectAdsBackup) { - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - - break; case "UNITY": - if (BuildConfig.DEBUG) { - tesMode = true; - } else { - tesMode = false; - } - + tesMode = BuildConfig.DEBUG; IUnityAdsInitializationListener listener = new IUnityAdsInitializationListener() { @Override public void onInitializationComplete() { @@ -303,10 +246,6 @@ public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, S System.currentTimeMillis(), true); break; - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - - break; case "FACEBOOK": if (!AudienceNetworkAds.isInitialized(activity)) { if (BuildConfig.DEBUG) { @@ -328,164 +267,9 @@ public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, S } public static void SelectAdsApplovinDis(Activity activity, String selectAdsBackup, String idInitialize) { - AppLovinSdk.initializeSdk(activity); - switch (selectAdsBackup) { - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - - break; - case "UNITY": - if (BuildConfig.DEBUG) { - tesMode = true; - } else { - tesMode = false; - } - - IUnityAdsInitializationListener listener = new IUnityAdsInitializationListener() { - @Override - public void onInitializationComplete() { - - } - - @Override - public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, String message) { - - } - }; - UnityAds.initialize(activity, idInitialize, tesMode, listener); - break; - case "STARTAPP": - StartAppSDK.init(activity, idInitialize, true); - StartAppAd.disableSplash(); - StartAppSDK.setUserConsent(activity, - "pas", - System.currentTimeMillis(), - true); - break; - case "ADMOB": - case "GOOGLE-ADS": - MobileAds.initialize(activity, new OnInitializationCompleteListener() { - @Override - public void onInitializationComplete(InitializationStatus initializationStatus) { - Map statusMap = initializationStatus.getAdapterStatusMap(); - for (String adapterClass : statusMap.keySet()) { - AdapterStatus status = statusMap.get(adapterClass); - Log.d("MyApp", String.format( - "Adapter name: %s, Description: %s, Latency: %d", - adapterClass, status.getDescription(), status.getLatency())); - } - } - }); - break; - case "FACEBOOK": - if (!AudienceNetworkAds.isInitialized(activity)) { - if (BuildConfig.DEBUG) { - AdSettings.turnOnSDKDebugger(activity); - AdSettings.setTestMode(true); - } - AudienceNetworkAds - .buildInitSettings(activity) - .withInitListener(new AudienceNetworkInitializeHelper()) - .initialize(); - } - break; - case "ALIEN-M": - PropsAdsManagement.initializeAdsMapping(activity); - break; - - } } public static void SelectAdsApplovinMax(Activity activity, String selectAdsBackup, String idInitialize) { - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - if(BuildConfig.DEBUG){ - - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; - case "UNITY": - if (BuildConfig.DEBUG) { - tesMode = true; - } else { - tesMode = false; - } - - IUnityAdsInitializationListener listener = new IUnityAdsInitializationListener() { - @Override - public void onInitializationComplete() { - - } - - @Override - public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, String message) { - - } - }; - UnityAds.initialize(activity, idInitialize, tesMode, listener); - break; - case "STARTAPP": - StartAppSDK.init(activity, idInitialize, true); - StartAppAd.disableSplash(); - StartAppSDK.setUserConsent(activity, - "pas", - System.currentTimeMillis(), - true); - break; - case "ADMOB": - case "GOOGLE-ADS": - MobileAds.initialize(activity, new OnInitializationCompleteListener() { - @Override - public void onInitializationComplete(InitializationStatus initializationStatus) { - Map statusMap = initializationStatus.getAdapterStatusMap(); - for (String adapterClass : statusMap.keySet()) { - AdapterStatus status = statusMap.get(adapterClass); - Log.d("MyApp", String.format( - "Adapter name: %s, Description: %s, Latency: %d", - adapterClass, status.getDescription(), status.getLatency())); - } - } - }); - break; - case "FACEBOOK": - if (!AudienceNetworkAds.isInitialized(activity)) { - if (BuildConfig.DEBUG) { - AdSettings.turnOnSDKDebugger(activity); - AdSettings.setTestMode(true); - } - AudienceNetworkAds - .buildInitSettings(activity) - .withInitListener(new AudienceNetworkInitializeHelper()) - .initialize(); - } - break; - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - - } - }); - - break; - case "ALIEN-M": - PropsAdsManagement.initializeAdsMapping(activity); - break; - - } } public static void SelectAdsMopub(Activity activity, String selectAdsBackup, String idInitialize, String idInitializeBackupAds) { @@ -500,19 +284,6 @@ public static void SelectAdsStartApp(Activity activity, String selectAdsBackup, System.currentTimeMillis(), true); switch (selectAdsBackup) { - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - - break; case "UNITY": if (BuildConfig.DEBUG) { tesMode = true; @@ -591,19 +362,6 @@ public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, S }; UnityAds.initialize(activity, idInitialize, tesMode, listener); switch (selectAdsBackup) { - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - - break; case "STARTAPP": StartAppSDK.init(activity, idInitializeBackupAds, true); StartAppAd.disableSplash(); @@ -659,19 +417,6 @@ public static void SelectAdsFAN(Activity activity, String selectAdsBackup, Strin .initialize(); } switch (selectAdsBackup) { - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - - break; case "STARTAPP": StartAppSDK.init(activity, idInitializeBackupAds, true); StartAppAd.disableSplash(); @@ -736,107 +481,11 @@ public void onInitializationComplete(InitializationStatus initializationStatus) } public static void SelectAdsAlienView(Activity activity, String selectAdsBackup, String idInitializeBackupAds) { - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - - } - }); - if(BuildConfig.DEBUG){ - - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; - case "APPLOVIN-M": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - - break; - case "STARTAPP": - StartAppSDK.init(activity, idInitializeBackupAds, true); - StartAppAd.disableSplash(); - StartAppSDK.setUserConsent(activity, - "pas", - System.currentTimeMillis(), - true); - break; - case "UNITY": - if (BuildConfig.DEBUG) { - tesMode = true; - } else { - tesMode = false; - } - - IUnityAdsInitializationListener listener = new IUnityAdsInitializationListener() { - @Override - public void onInitializationComplete() { - - } - - @Override - public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, String message) { - - } - }; - UnityAds.initialize(activity, idInitializeBackupAds, tesMode, listener); - break; - case "ADMOB": - case "GOOGLE-ADS": - MobileAds.initialize(activity, new OnInitializationCompleteListener() { - @Override - public void onInitializationComplete(InitializationStatus initializationStatus) { - Map statusMap = initializationStatus.getAdapterStatusMap(); - for (String adapterClass : statusMap.keySet()) { - AdapterStatus status = statusMap.get(adapterClass); - Log.d("MyApp", String.format( - "Adapter name: %s, Description: %s, Latency: %d", - adapterClass, status.getDescription(), status.getLatency())); - } - } - }); - break; - case "FACEBOOK": - if (!AudienceNetworkAds.isInitialized(activity)) { - if (BuildConfig.DEBUG) { - AdSettings.turnOnSDKDebugger(activity); - AdSettings.setTestMode(true); - } - AudienceNetworkAds - .buildInitSettings(activity) - .withInitListener(new AudienceNetworkInitializeHelper()) - .initialize(); - } - break; - case "ALIEN-M": - PropsAdsManagement.initializeAdsMapping(activity); - break; - - } } public static void SelectAdsAlienMediation(Activity activity, String selectAdsBackup, String idInitialize, String idInitializeBackupAds) { PropsAdsManagement.initializeAdsMapping(activity); switch (selectAdsBackup) { - case "APPLOVIN-D": - AppLovinSdk.initializeSdk(activity); - break; - case "APPLOVIN-M": - case "ALIEN-V": - AppLovinSdk.getInstance(activity).setMediationProvider("max"); - AppLovinSdk.initializeSdk(activity, new AppLovinSdk.SdkInitializationListener() { - @Override - public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { - } - }); - - break; case "STARTAPP": StartAppSDK.init(activity, idInitializeBackupAds, true); StartAppAd.disableSplash(); @@ -902,5 +551,4 @@ public static void SelectAdsWortise(Activity activity, String selectAdsBackup, S } - } diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidIntertitial.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidIntertitial.java index b6eac4c..1f492e1 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidIntertitial.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidIntertitial.java @@ -4,12 +4,10 @@ import android.app.Activity; import android.content.ContentValues; -import android.os.Bundle; import android.util.Log; import androidx.annotation.NonNull; -import com.aliendroid.alienads.config.AppLovinCustomEventInterstitial; import com.aliendroid.alienads.interfaces.interstitial.admob.OnFullScreenContentCallbackAdmob; import com.aliendroid.alienads.interfaces.interstitial.load.OnLoadInterstitialAdmob; import com.aliendroid.alienads.interfaces.interstitial.load.OnLoadInterstitialAlienMediation; @@ -30,14 +28,6 @@ import com.aliendroid.alienads.interfaces.interstitial.show.OnShowInterstitialGoogle; import com.aliendroid.alienads.interfaces.interstitial.show.OnShowInterstitialIronSource; import com.aliendroid.alienads.interfaces.interstitial.show.OnShowInterstitialStartApp; -import com.applovin.adview.AppLovinInterstitialAd; -import com.applovin.adview.AppLovinInterstitialAdDialog; -import com.applovin.mediation.ads.MaxInterstitialAd; -import com.applovin.sdk.AppLovinAd; -import com.applovin.sdk.AppLovinAdDisplayListener; -import com.applovin.sdk.AppLovinAdLoadListener; -import com.applovin.sdk.AppLovinAdSize; -import com.applovin.sdk.AppLovinSdk; import com.facebook.ads.AdError; import com.facebook.ads.InterstitialAdListener; import com.google.android.gms.ads.AdRequest; @@ -63,16 +53,11 @@ public class AliendroidIntertitial { public static InterstitialAd mInterstitialAd; public static InterstitialAd mInterstitialAd2; public static AdManagerInterstitialAd mAdManagerInterstitialAd; - public static MaxInterstitialAd interstitialAd; - public static MaxInterstitialAd jamboxInterstitialAd; public static com.facebook.ads.InterstitialAd FBinterstitialAd; public static com.facebook.ads.InterstitialAd FBinterstitialAd2; public static int counter = 0; - public static AppLovinInterstitialAdDialog interstitialAdlovin; - public static AppLovinAd loadedAd; public static boolean irininter = false; private static StartAppAd startAppAd; - public static boolean SHOW_ALIEN_VIEW = false; public static OnLoadInterstitialAdmob onLoadInterstitialAdmob; public static OnShowInterstitialAdmob onShowInterstitialAdmob; public static OnShowInterstitialGoogle onShowInterstitialGoogle; @@ -122,37 +107,10 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro e.printStackTrace(); } switch (selectAds) { - case "APPLOVIN-M": - interstitialAd = new MaxInterstitialAd(idBackupIntertitial, activity); - interstitialAd.loadAd(); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idBackupIntertitial); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - } - - @Override - public void failedToReceiveAd(int errorCode) { - // Look at AppLovinErrorCodes.java for list of error codes. - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; case "FACEBOOK": FBinterstitialAd = new com.facebook.ads.InterstitialAd(activity, idBackupIntertitial); FBinterstitialAd.loadAd(); break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idBackupIntertitial, activity); - jamboxInterstitialAd.loadAd(); - break; case "ALIEN-M": PropsAdsManagement.loadInterstitialAds(activity, idBackupIntertitial, new InterstitialAdLoadCallback() { @Override @@ -221,10 +179,6 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { } }); switch (selectAdsBackup) { - case "APPLOVIN-M": - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - break; case "UNITY": IUnityAdsLoadListener listener = new IUnityAdsLoadListener() { @Override @@ -243,34 +197,10 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro e.printStackTrace(); } break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitialBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - } - - @Override - public void failedToReceiveAd(int errorCode) { - // Look at AppLovinErrorCodes.java for list of error codes. - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; case "FACEBOOK": FBinterstitialAd = new com.facebook.ads.InterstitialAd(activity, idIntertitialBackup); FBinterstitialAd.loadAd(); break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); - break; case "ALIEN-M": PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { @Override @@ -357,16 +287,6 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { switch (selectAdsBackup) { - case "APPLOVIN-M": - if (idIntertitialBackup.equals("")) { - interstitialAd = new MaxInterstitialAd("qwerty12345", activity); - interstitialAd.loadAd(); - } else { - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - } - - break; case "UNITY": IUnityAdsLoadListener listener = new IUnityAdsLoadListener() { @Override @@ -385,33 +305,10 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro e.printStackTrace(); } break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitialBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - } - - @Override - public void failedToReceiveAd(int errorCode) { - // Look at AppLovinErrorCodes.java for list of error codes. - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; case "FACEBOOK": FBinterstitialAd = new com.facebook.ads.InterstitialAd(activity, idIntertitialBackup); FBinterstitialAd.loadAd(); break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); - break; case "ALIEN-M": PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { @Override @@ -480,16 +377,6 @@ public void onLoggingImpression(com.facebook.ads.Ad ad) { .build()); switch (selectAdsBackup) { - case "APPLOVIN-M": - if (idIntertitialBackup.equals("")) { - interstitialAd = new MaxInterstitialAd("qwerty12345", activity); - interstitialAd.loadAd(); - } else { - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - } - - break; case "UNITY": IUnityAdsLoadListener listener = new IUnityAdsLoadListener() { @Override @@ -512,24 +399,6 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro FBinterstitialAd2 = new com.facebook.ads.InterstitialAd(activity, idIntertitialBackup); FBinterstitialAd2.loadAd(); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitialBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - } - - @Override - public void failedToReceiveAd(int errorCode) { - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; case "ADMOB": AdRequest request = new AdRequest.Builder() .build(); @@ -571,10 +440,6 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { } }); - break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); break; case "ALIEN-M": PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { @@ -595,353 +460,15 @@ public void onAdLoaded(@NonNull InterstitialAd interstitialAdProps) { public static void LoadIntertitialApplovinDis(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup ) { - - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitial); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - if (onLoadInterstitialApplovinDiscovery != null) { - onLoadInterstitialApplovinDiscovery.adReceived(); - } - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadInterstitialApplovinDiscovery != null) { - onLoadInterstitialApplovinDiscovery.failedToReceiveAd(""); - } - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - - switch (selectAdsBackup) { - case "APPLOVIN-M": - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - break; - case "UNITY": - IUnityAdsLoadListener listener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idIntertitialBackup, listener); - } catch (Exception e) { - e.printStackTrace(); - } - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - InterstitialAd.load(activity, idIntertitialBackup, request, - new InterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAd) { - mInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - Log.i(TAG, loadAdError.getMessage()); - mInterstitialAd = null; - } - }); - break; - case "FACEBOOK": - FBinterstitialAd = new com.facebook.ads.InterstitialAd(activity, idIntertitialBackup); - FBinterstitialAd.loadAd(); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - AdManagerInterstitialAd.load(activity, idIntertitialBackup, adRequest, - new AdManagerInterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull AdManagerInterstitialAd interstitialAd) { - mAdManagerInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - Log.i(TAG, loadAdError.getMessage()); - mAdManagerInterstitialAd = null; - } - }); - - break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - super.onAdFailedToLoad(loadAdError); - - } - - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAdProps) { - super.onAdLoaded(interstitialAdProps); - } - }); - break; - } } public static void LoadIntertitialApplovinDisHPK(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup, String HPK1, String HPK2, String HPK3, String HPK4, String HPK5) { - - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(HPK1).addKeyword(HPK2).addKeyword(HPK3).addKeyword(HPK4).addKeyword(HPK5); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitial); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - if (onLoadInterstitialApplovinDiscovery != null) { - onLoadInterstitialApplovinDiscovery.adReceived(); - } - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadInterstitialApplovinDiscovery != null) { - onLoadInterstitialApplovinDiscovery.failedToReceiveAd(""); - } - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - - switch (selectAdsBackup) { - case "APPLOVIN-M": - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - break; - case "UNITY": - IUnityAdsLoadListener listener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idIntertitialBackup, listener); - } catch (Exception e) { - e.printStackTrace(); - } - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - InterstitialAd.load(activity, idIntertitialBackup, request, - new InterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAd) { - // The mInterstitialAd reference will be null until - // an ad is loaded. - mInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - Log.i(TAG, loadAdError.getMessage()); - mInterstitialAd = null; - } - }); - break; - case "FACEBOOK": - FBinterstitialAd = new com.facebook.ads.InterstitialAd(activity, idIntertitialBackup); - FBinterstitialAd.loadAd(); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - AdManagerInterstitialAd.load(activity, idIntertitialBackup, adRequest, - new AdManagerInterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull AdManagerInterstitialAd interstitialAd) { - // The mAdManagerInterstitialAd reference will be null until - // an ad is loaded. - mAdManagerInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - Log.i(TAG, loadAdError.getMessage()); - mAdManagerInterstitialAd = null; - } - }); - - break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - super.onAdFailedToLoad(loadAdError); - - } - - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAdProps) { - super.onAdLoaded(interstitialAdProps); - } - }); - break; - } } public static void LoadIntertitialApplovinMax(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup) { - interstitialAd = new MaxInterstitialAd(idIntertitial, activity); - interstitialAd.loadAd(); - - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitialBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - if (onLoadInterstitialApplovinMax != null) { - onLoadInterstitialApplovinMax.adReceived(); - } - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadInterstitialApplovinMax != null) { - onLoadInterstitialApplovinMax.failedToReceiveAd(""); - } - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; - case "UNITY": - IUnityAdsLoadListener listener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idIntertitialBackup, listener); - } catch (Exception e) { - e.printStackTrace(); - } - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - InterstitialAd.load(activity, idIntertitialBackup, request, - new InterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAd) { - // The mInterstitialAd reference will be null until - // an ad is loaded. - mInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - Log.i(TAG, loadAdError.getMessage()); - mInterstitialAd = null; - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - AdManagerInterstitialAd.load(activity, idIntertitialBackup, adRequest, - new AdManagerInterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull AdManagerInterstitialAd interstitialAd) { - // The mAdManagerInterstitialAd reference will be null until - // an ad is loaded. - mAdManagerInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - Log.i(TAG, loadAdError.getMessage()); - mAdManagerInterstitialAd = null; - } - }); - - break; - case "FACEBOOK": - FBinterstitialAd = new com.facebook.ads.InterstitialAd(activity, idIntertitialBackup); - FBinterstitialAd.loadAd(); - break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - super.onAdFailedToLoad(loadAdError); - - } - - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAdProps) { - super.onAdLoaded(interstitialAdProps); - } - }); - break; - } } public static void LoadIntertitialIron(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup) { @@ -970,28 +497,6 @@ public void onFailedToReceiveAd(Ad ad) { } }); switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitialBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - } - - @Override - public void failedToReceiveAd(int errorCode) { - // Look at AppLovinErrorCodes.java for list of error codes. - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; - case "APPLOVIN-M": - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - break; case "ADMOB": AdRequest request = new AdRequest.Builder() .build(); @@ -1052,10 +557,6 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { } }); break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); - break; case "ALIEN-M": PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { @Override @@ -1073,128 +574,7 @@ public void onAdLoaded(@NonNull InterstitialAd interstitialAdProps) { } } - public static void LoadIntertitialAlienView(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup) { - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitial, activity); - jamboxInterstitialAd.loadAd(); - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitialBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - } - - @Override - public void failedToReceiveAd(int errorCode) { - // Look at AppLovinErrorCodes.java for list of error codes. - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; - case "APPLOVIN-M": - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - InterstitialAd.load(activity, idIntertitialBackup, request, - new InterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAd) { - mInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - Log.i(TAG, loadAdError.getMessage()); - mInterstitialAd = null; - } - }); - break; - case "UNITY": - IUnityAdsLoadListener listener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idIntertitialBackup, listener); - } catch (Exception e) { - e.printStackTrace(); - } - break; - case "FACEBOOK": - FBinterstitialAd = new com.facebook.ads.InterstitialAd(activity, idIntertitialBackup); - FBinterstitialAd.loadAd(); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - AdManagerInterstitialAd.load(activity, idIntertitialBackup, adRequest, - new AdManagerInterstitialAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull AdManagerInterstitialAd interstitialAd) { - mAdManagerInterstitialAd = interstitialAd; - Log.i(TAG, "onAdLoaded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - Log.i(TAG, loadAdError.getMessage()); - mAdManagerInterstitialAd = null; - } - }); - - break; - case "STARTAPP": - startAppAd = new StartAppAd(activity); - startAppAd.loadAd(new AdEventListener() { - @Override - public void onReceiveAd(Ad ad) { - if (onLoadInterstitialStartApp != null) { - onLoadInterstitialStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(Ad ad) { - if (onLoadInterstitialStartApp != null) { - onLoadInterstitialStartApp.onFailedToReceiveAd(""); - } - } - }); - break; - case "ALIEN-M": - PropsAdsManagement.loadInterstitialAds(activity, idIntertitialBackup, new InterstitialAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - super.onAdFailedToLoad(loadAdError); - - } - - @Override - public void onAdLoaded(@NonNull InterstitialAd interstitialAdProps) { - super.onAdLoaded(interstitialAdProps); - } - }); - break; - - } + public static void LoadIntertitialAlienView(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup) { } public static void LoadIntertitialAlienMediation(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup) { @@ -1211,28 +591,6 @@ public void onAdLoaded(@NonNull InterstitialAd interstitialAdProps) { } }); switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle interstitialExtras = new Bundle(); - interstitialExtras.putString("zone_id", idIntertitialBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventInterstitial.class, interstitialExtras); - AppLovinSdk.getInstance(activity).getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - loadedAd = ad; - } - - @Override - public void failedToReceiveAd(int errorCode) { - - } - }); - interstitialAdlovin = AppLovinInterstitialAd.create(AppLovinSdk.getInstance(activity), activity); - break; - case "APPLOVIN-M": - interstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - interstitialAd.loadAd(); - break; case "ADMOB": AdRequest request = new AdRequest.Builder() .build(); @@ -1313,10 +671,6 @@ public void onFailedToReceiveAd(Ad ad) { } }); break; - case "ALIEN-V": - jamboxInterstitialAd = new MaxInterstitialAd(idIntertitialBackup, activity); - jamboxInterstitialAd.loadAd(); - break; } } @@ -1382,14 +736,6 @@ public void onAdShowedFullScreenContent() { onShowInterstitialAdmob.onAdFailedShow(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -1418,25 +764,12 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp case "STARTAPP": StartAppAd.showAd(activity); break; - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; case "FACEBOOK": if (FBinterstitialAd == null || !FBinterstitialAd.isAdLoaded()) { } else { FBinterstitialAd.show(); } break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getInterstitialAds() != null) { PropsAdsManagement.getInterstitialAds().show(activity); @@ -1470,14 +803,6 @@ public static void ShowIntertitialGoogleAds(Activity activity, String selectAdsB onShowInterstitialGoogle.onAdFailedShow(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -1506,25 +831,12 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp case "STARTAPP": StartAppAd.showAd(activity); break; - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; case "FACEBOOK": if (FBinterstitialAd == null || !FBinterstitialAd.isAdLoaded()) { } else { FBinterstitialAd.show(); } break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getInterstitialAds() != null) { PropsAdsManagement.getInterstitialAds().show(activity); @@ -1542,285 +854,15 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp public static void ShowIntertitialApplovinDis(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup, int interval) { - if (counter >= interval) { - if (interstitialAdlovin != null) { - AppLovinAdDisplayListener listener = new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd ad) { - if (onShowInterstitialApplovinDiscovery != null) { - onShowInterstitialApplovinDiscovery.onAdSuccess(); - } - } - - @Override - public void adHidden(AppLovinAd ad) { - if (onShowInterstitialApplovinDiscovery != null) { - onShowInterstitialApplovinDiscovery.onAdFailedShow(); - } - switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; - case "UNITY": - IUnityAdsShowListener showListener = new IUnityAdsShowListener() { - @Override - public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { - - } - - @Override - public void onUnityAdsShowStart(String placementId) { - - } - - @Override - public void onUnityAdsShowClick(String placementId) { - - } - - @Override - public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { - - } - }; - UnityAds.show(activity, idIntertitialBackup, new UnityAdsShowOptions(), showListener); - break; - case "STARTAPP": - StartAppAd.showAd(activity); - break; - case "ADMOB": - if (mInterstitialAd != null) { - mInterstitialAd.show(activity); - } - break; - case "GOOGLE-ADS": - if (mAdManagerInterstitialAd != null) { - mAdManagerInterstitialAd.show(activity); - } - break; - case "FACEBOOK": - if (FBinterstitialAd != null || !FBinterstitialAd.isAdLoaded()) { - FBinterstitialAd.show(); - } - break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; - case "ALIEN-M": - if (PropsAdsManagement.getInterstitialAds() != null) { - PropsAdsManagement.getInterstitialAds().show(activity); - } - break; - } - LoadIntertitialApplovinDis(activity, selectAdsBackup, idIntertitial, idIntertitialBackup); - } - }; - interstitialAdlovin.setAdDisplayListener(listener); - interstitialAdlovin.showAndRender(loadedAd); - LoadIntertitialApplovinDis(activity, selectAdsBackup, idIntertitial, idIntertitialBackup); - } - counter = 0; - } else { - counter++; - } - } public static void ShowIntertitialApplovinDisHPK(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup, int interval, String HPK1, String HPK2, String HPK3, String HPK4, String HPK5) { - if (counter >= interval) { - if (interstitialAdlovin != null) { - AppLovinAdDisplayListener listener = new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd ad) { - if (onShowInterstitialApplovinDiscovery != null) { - onShowInterstitialApplovinDiscovery.onAdSuccess(); - } - } - - @Override - public void adHidden(AppLovinAd ad) { - if (onShowInterstitialApplovinDiscovery != null) { - onShowInterstitialApplovinDiscovery.onAdFailedShow(); - } - switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; - case "UNITY": - IUnityAdsShowListener showListener = new IUnityAdsShowListener() { - @Override - public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { - - } - - @Override - public void onUnityAdsShowStart(String placementId) { - - } - - @Override - public void onUnityAdsShowClick(String placementId) { - - } - - @Override - public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { - - } - }; - UnityAds.show(activity, idIntertitialBackup, new UnityAdsShowOptions(), showListener); - break; - case "STARTAPP": - StartAppAd.showAd(activity); - break; - case "ADMOB": - if (mInterstitialAd != null) { - mInterstitialAd.show(activity); - } - break; - case "GOOGLE-ADS": - if (mAdManagerInterstitialAd != null) { - mAdManagerInterstitialAd.show(activity); - } - break; - case "FACEBOOK": - if (FBinterstitialAd != null || !FBinterstitialAd.isAdLoaded()) { - FBinterstitialAd.show(); - } - break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; - case "ALIEN-M": - if (PropsAdsManagement.getInterstitialAds() != null) { - PropsAdsManagement.getInterstitialAds().show(activity); - } - break; - } - LoadIntertitialApplovinDisHPK(activity, selectAdsBackup, idIntertitial, idIntertitialBackup, HPK1, - HPK2, HPK3, HPK4, HPK5); - } - }; - interstitialAdlovin.setAdDisplayListener(listener); - interstitialAdlovin.showAndRender(loadedAd); - LoadIntertitialApplovinDisHPK(activity, selectAdsBackup, idIntertitial, idIntertitialBackup, HPK1, - HPK2, HPK3, HPK4, HPK5); - } - - counter = 0; - } else { - counter++; - } - } public static void ShowIntertitialApplovinMax(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup, int interval) { - if (counter >= interval) { - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - LoadIntertitialApplovinMax(activity, selectAdsBackup, idIntertitial, idIntertitialBackup); - if (onShowInterstitialApplovinMax != null) { - onShowInterstitialApplovinMax.onAdSuccess(); - } - } else { - if (onShowInterstitialApplovinMax != null) { - onShowInterstitialApplovinMax.onAdFailedShow(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; - case "UNITY": - IUnityAdsShowListener showListener = new IUnityAdsShowListener() { - @Override - public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { - - } - - @Override - public void onUnityAdsShowStart(String placementId) { - - } - - @Override - public void onUnityAdsShowClick(String placementId) { - - } - - @Override - public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { - - } - }; - UnityAds.show(activity, idIntertitialBackup, new UnityAdsShowOptions(), showListener); - - break; - case "STARTAPP": - StartAppAd.showAd(activity); - break; - case "ADMOB": - if (mInterstitialAd != null) { - mInterstitialAd.show(activity); - } - break; - case "GOOGLE-ADS": - if (mAdManagerInterstitialAd != null) { - mAdManagerInterstitialAd.show(activity); - } - break; - case "FACEBOOK": - if (FBinterstitialAd == null || !FBinterstitialAd.isAdLoaded()) { - } else { - FBinterstitialAd.show(); - } - break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; - case "ALIEN-M": - if (PropsAdsManagement.getInterstitialAds() != null) { - PropsAdsManagement.getInterstitialAds().show(activity); - } - break; - } - interstitialAd.loadAd(); - } - LoadIntertitialApplovinMax(activity, selectAdsBackup, idIntertitial, idIntertitialBackup); - counter = 0; - } else { - counter++; - } - } public static void ShowIntertitialIron(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup, @@ -1831,11 +873,6 @@ public static void ShowIntertitialIron(Activity activity, String selectAdsBackup onShowInterstitialIronSource.onAdFailedShow(); } switch (selectAdsBackup) { - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -1860,11 +897,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp }; UnityAds.show(activity, idIntertitialBackup, new UnityAdsShowOptions(), showListener); - break; - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - } break; case "STARTAPP": StartAppAd.showAd(activity); @@ -1885,14 +917,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp FBinterstitialAd.show(); } break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getInterstitialAds() != null) { PropsAdsManagement.getInterstitialAds().show(activity); @@ -1949,16 +973,6 @@ public void adNotDisplayed(Ad ad) { onShowInterstitialStartApp.adNotDisplayed(); } switch (selectAdsBackup) { - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -2000,14 +1014,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp FBinterstitialAd.show(); } break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getInterstitialAds() != null) { PropsAdsManagement.getInterstitialAds().show(activity); @@ -2030,14 +1036,6 @@ public static void ShowIntertitialFAN(Activity activity, String selectAdsBackup, if (counter >= interval) { if (FBinterstitialAd == null || !FBinterstitialAd.isAdLoaded()) { switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -2066,11 +1064,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp case "STARTAPP": StartAppAd.showAd(activity); break; - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; case "ADMOB": if (mInterstitialAd != null) { mInterstitialAd.show(activity); @@ -2081,14 +1074,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp mAdManagerInterstitialAd.show(activity); } break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getInterstitialAds() != null) { PropsAdsManagement.getInterstitialAds().show(activity); @@ -2126,14 +1111,6 @@ public static void ShowIntertitialUnity(Activity activity, String selectAdsBacku @Override public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -2161,25 +1138,12 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp case "STARTAPP": StartAppAd.showAd(activity); break; - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; case "FACEBOOK": if (FBinterstitialAd == null || !FBinterstitialAd.isAdLoaded()) { } else { FBinterstitialAd.show(); } break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getInterstitialAds() != null) { PropsAdsManagement.getInterstitialAds().show(activity); @@ -2219,82 +1183,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp public static void ShowIntertitialAlienView(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup, int interval) { - if (counter >= interval) { - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; - case "UNITY": - IUnityAdsShowListener showListener = new IUnityAdsShowListener() { - @Override - public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { - - } - - @Override - public void onUnityAdsShowStart(String placementId) { - - } - - @Override - public void onUnityAdsShowClick(String placementId) { - - } - - @Override - public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { - - } - }; - UnityAds.show(activity, idIntertitialBackup, new UnityAdsShowOptions(), showListener); - break; - case "STARTAPP": - StartAppAd.showAd(activity); - break; - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; - case "ADMOB": - if (mInterstitialAd != null) { - mInterstitialAd.show(activity); - } - break; - case "GOOGLE-ADS": - if (mAdManagerInterstitialAd != null) { - mAdManagerInterstitialAd.show(activity); - } - break; - case "FACEBOOK": - if (FBinterstitialAd == null || !FBinterstitialAd.isAdLoaded()) { - } else { - FBinterstitialAd.show(); - } - break; - case "ALIEN-M": - if (PropsAdsManagement.getInterstitialAds() != null) { - PropsAdsManagement.getInterstitialAds().show(activity); - } - break; - - } - } - LoadIntertitialAlienView(activity, selectAdsBackup, idIntertitial, idIntertitialBackup); - counter = 0; - } else { - counter++; - } } public static void ShowIntertitialAlienMediation(Activity activity, String selectAdsBackup, String idIntertitial, String idIntertitialBackup, @@ -2304,14 +1192,6 @@ public static void ShowIntertitialAlienMediation(Activity activity, String selec PropsAdsManagement.getInterstitialAds().show(activity); } else { switch (selectAdsBackup) { - case "APPLOVIN-M": - if (interstitialAd.isReady()) { - interstitialAd.showAd(); - interstitialAd.loadAd(); - } else { - interstitialAd.loadAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -2339,11 +1219,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp case "STARTAPP": StartAppAd.showAd(activity); break; - case "APPLOVIN-D": - if (interstitialAdlovin != null) { - interstitialAdlovin.showAndRender(loadedAd); - } - break; case "ADMOB": if (mInterstitialAd != null) { mInterstitialAd.show(activity); @@ -2360,15 +1235,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp FBinterstitialAd.show(); } break; - case "ALIEN-V": - if (jamboxInterstitialAd.isReady()) { - jamboxInterstitialAd.showAd(); - jamboxInterstitialAd.loadAd(); - } else { - jamboxInterstitialAd.loadAd(); - } - break; - } } diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidMediumBanner.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidMediumBanner.java index 4b9775c..ba739bd 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidMediumBanner.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidMediumBanner.java @@ -1,14 +1,11 @@ package com.aliendroid.alienads; import android.app.Activity; -import android.os.Bundle; import android.view.View; import android.widget.RelativeLayout; import androidx.annotation.NonNull; -import androidx.constraintlayout.widget.ConstraintLayout; -import com.aliendroid.alienads.config.AppLovinCustomEventBanner; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerAdmob; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerAlienMediation; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerAlienView; @@ -19,16 +16,6 @@ import com.aliendroid.alienads.interfaces.banner.OnLoadBannerIronSource; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerStartApp; import com.aliendroid.alienads.interfaces.banner.OnLoadBannerWortise; -import com.applovin.adview.AppLovinAdView; -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxAdFormat; -import com.applovin.mediation.MaxAdViewAdListener; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.ads.MaxAdView; -import com.applovin.sdk.AppLovinAd; -import com.applovin.sdk.AppLovinAdLoadListener; -import com.applovin.sdk.AppLovinAdSize; -import com.applovin.sdk.AppLovinSdkUtils; import com.facebook.ads.Ad; import com.facebook.ads.AdError; import com.google.android.gms.ads.AdListener; @@ -48,12 +35,9 @@ public class AliendroidMediumBanner { - public static MaxAdView jamboxBanner; - public static MaxAdView adViewMax; public static AdView adViewAdmob; public static AdView adViewAdmob2; public static AdManagerAdView bannerGoogleAds; - public static AppLovinAdView adViewDiscovery; public static Banner startAppBanner; public static Mrec startAppMrec; public static BannerView unityBanner; @@ -88,16 +72,6 @@ public void onAdLoaded() { onLoadBannerAdmob.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); @@ -108,11 +82,6 @@ public void onAdLoaded() { startAppBanner.hideBanner(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; case "FACEBOOK": if (adViewFAN != null) { adViewFAN.destroy(); @@ -128,76 +97,6 @@ public void onAdFailedToLoad(LoadAdError adError) { onLoadBannerAdmob.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); unityBanner.load(); @@ -242,36 +141,6 @@ public void onClick(View view) { bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); layAds.addView(startAppMrec, bannerParameters); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; case "FACEBOOK": adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); @@ -310,75 +179,6 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; case "ALIEN-M": PropsAdsManagement propsAds = new PropsAdsManagement(activity); AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); @@ -468,16 +268,6 @@ public void onAdLoaded() { onLoadBannerGoogle.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); @@ -488,11 +278,6 @@ public void onAdLoaded() { startAppBanner.hideBanner(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; case "FACEBOOK": if (adViewFAN != null) { adViewFAN.destroy(); @@ -509,76 +294,6 @@ public void onAdFailedToLoad(LoadAdError adError) { onLoadBannerGoogle.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); unityBanner.load(); @@ -623,35 +338,6 @@ public void onClick(View view) { bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); layAds.addView(startAppMrec, bannerParameters); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; case "FACEBOOK": adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); @@ -690,75 +376,6 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; case "ALIEN-M": PropsAdsManagement propsAds = new PropsAdsManagement(activity); AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); @@ -805,76 +422,6 @@ public void onError(Ad ad, AdError adError) { onLoadBannerFacebook.onError(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); unityBanner.load(); @@ -1058,151 +605,53 @@ public void onAdClosed() { } }); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - + case "ALIEN-M": + PropsAdsManagement propsAds = new PropsAdsManagement(activity); + AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); + AdRequest adRequestProps = new AdRequest.Builder().build(); + layAds.addView(adView); + adView.loadAd(adRequestProps); + break; + case "FACEBOOK": + adViewFAN2 = new com.facebook.ads.AdView(activity, idBannerBackup, + com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); + layAds.addView(adViewFAN2); + com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); + public void onError(Ad ad, AdError adError) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onError(); } layAds.setVisibility(View.GONE); } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); + public void onAdLoaded(Ad ad) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onAdLoaded(); } - } - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } } @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); + public void onAdClicked(Ad ad) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onAdClicked(); } } @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); + public void onLoggingImpression(Ad ad) { + if (onLoadBannerFacebook != null) { + onLoadBannerFacebook.onLoggingImpression(); } } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); - AdRequest adRequestProps = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequestProps); - break; - case "FACEBOOK": - adViewFAN2 = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); - layAds.addView(adViewFAN2); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN2.loadAd(adViewFAN2.buildLoadAdConfig().withAdListener(adListener).build()); - break; - } - } + }; + adViewFAN2.loadAd(adViewFAN2.buildLoadAdConfig().withAdListener(adListener).build()); + break; + } + } @Override public void onAdLoaded(Ad ad) { @@ -1210,16 +659,6 @@ public void onAdLoaded(Ad ad) { onLoadBannerFacebook.onAdLoaded(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); @@ -1240,12 +679,6 @@ public void onAdLoaded(Ad ad) { bannerGoogleAds.destroy(); } break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - } } @@ -1269,45 +702,37 @@ public void onLoggingImpression(Ad ad) { public static void MediumBannerApplovinDisHPK(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup, String HPK1, String HPK2, String HPK3, String HPK4, String HPK5) { + } + + public static void MediumBannerApplovinDis(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + } + + public static void MediumBannerApplovinMax(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + } + + public static void MediumBannerMopub(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(HPK1).addKeyword(HPK2).addKeyword(HPK3).addKeyword(HPK4).addKeyword(HPK5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBanner); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { + } + + public static void MediumBannerStartApp(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + startAppMrec = new Mrec(activity, new BannerListener() { @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); + public void onReceiveAd(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onReceiveAd(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; case "UNITY": if (unityBanner != null) { unityBanner.destroy(); } break; - case "STARTAPP": - if (startAppBanner != null) { - startAppBanner.hideBanner(); - } - break; case "ADMOB": if (adViewAdmob != null) { adViewAdmob.destroy(); } break; - case "GOOGLE-ADS": if (bannerGoogleAds != null) { bannerGoogleAds.destroy(); @@ -1323,127 +748,17 @@ public void adReceived(AppLovinAd ad) { } @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); + public void onFailedToReceiveAd(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onFailedToReceiveAd(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); unityBanner.load(); layAds.addView(unityBanner); break; - case "STARTAPP": - startAppMrec = new Mrec(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppMrec, bannerParameters); - break; case "ADMOB": - AdRequest request = new AdRequest.Builder() .build(); adViewAdmob = new AdView(activity); @@ -1579,75 +894,6 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; case "ALIEN-M": PropsAdsManagement propsAds = new PropsAdsManagement(activity); AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); @@ -1657,141 +903,74 @@ public void onAdDisplayFailed(MaxAd ad, MaxError error) { break; } } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - } + @Override + public void onImpression(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onImpression(); + } + } - public static void MediumBannerApplovinDis(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBanner); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); + public void onClick(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onClick(); } + } + }); + RelativeLayout.LayoutParams bannerParameters = + new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); + layAds.addView(startAppMrec, bannerParameters); + } + + public static void MediumBannerIron(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + } + + public static void MediumBannerUnity(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + unityBanner = new BannerView(activity, idBanner, new UnityBannerSize(300, 250)); + unityBanner.load(); + layAds.addView(unityBanner); + unityBanner.setListener(new BannerView.IListener() { + @Override + public void onBannerLoaded(BannerView bannerAdView) { switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } break; case "STARTAPP": if (startAppBanner != null) { startAppBanner.hideBanner(); } break; + case "FACEBOOK": + if (adViewFAN != null) { + adViewFAN.destroy(); + } + break; + case "ADMOB": if (adViewAdmob != null) { adViewAdmob.destroy(); } break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - } } @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } + public void onBannerShown(BannerView bannerAdView) { - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } + } - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } + @Override + public void onBannerClick(BannerView bannerAdView) { - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; + } + @Override + public void onBannerFailedToLoad(BannerView bannerAdView, BannerErrorInfo errorInfo) { + switch (selectAdsBackup) { case "UNITY": unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); unityBanner.load(); @@ -1810,1668 +989,31 @@ public void onReceiveAd(View view) { @Override public void onFailedToReceiveAd(View view) { if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppMrec, bannerParameters); - break; - case "ADMOB": - - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - adViewAdmob.setAdSize(AdSize.MEDIUM_RECTANGLE); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - bannerGoogleAds.setAdSize(AdSize.MEDIUM_RECTANGLE); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); - } - } - }); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); - AdRequest adRequestProps = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequestProps); - break; - } - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - - } - - public static void MediumBannerApplovinMax(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - adViewMax = new MaxAdView(idBanner, MaxAdFormat.MREC, activity); - adViewMax.stopAutoRefresh(); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "STARTAPP": - if (startAppBanner != null) { - startAppBanner.hideBanner(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; - - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "STARTAPP": - startAppMrec = new Mrec(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppMrec, bannerParameters); - break; - case "ADMOB": - - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - adViewAdmob.setAdSize(AdSize.MEDIUM_RECTANGLE); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - bannerGoogleAds.setAdSize(AdSize.MEDIUM_RECTANGLE); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); - } - } - }); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); - AdRequest adRequestProps = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequestProps); - break; - } - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - } - - public static void MediumBannerMopub(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - - - } - - public static void MediumBannerStartApp(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - startAppMrec = new Mrec(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - - } - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "ADMOB": - - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - adViewAdmob.setAdSize(AdSize.MEDIUM_RECTANGLE); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - bannerGoogleAds.setAdSize(AdSize.MEDIUM_RECTANGLE); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); - } - } - }); - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); - AdRequest adRequestProps = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequestProps); - break; - } - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppMrec, bannerParameters); - } - - public static void MediumBannerIron(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - } - - public static void MediumBannerUnity(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - unityBanner = new BannerView(activity, idBanner, new UnityBannerSize(300, 250)); - unityBanner.load(); - layAds.addView(unityBanner); - unityBanner.setListener(new BannerView.IListener() { - @Override - public void onBannerLoaded(BannerView bannerAdView) { - switch (selectAdsBackup) { - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; - case "UNITY": - break; - case "STARTAPP": - if (startAppBanner != null) { - startAppBanner.hideBanner(); - } - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - } - } - - @Override - public void onBannerShown(BannerView bannerAdView) { - - } - - @Override - public void onBannerClick(BannerView bannerAdView) { - - } - - @Override - public void onBannerFailedToLoad(BannerView bannerAdView, BannerErrorInfo errorInfo) { - switch (selectAdsBackup) { - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "STARTAPP": - startAppMrec = new Mrec(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppMrec, bannerParameters); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; - case "FACEBOOK": - adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, - com.facebook.ads.AdSize.RECTANGLE_HEIGHT_250); - layAds.addView(adViewFAN); - com.facebook.ads.AdListener adListener = new com.facebook.ads.AdListener() { - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onError(); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdLoaded(); - } - - } - - @Override - public void onAdClicked(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onAdClicked(); - } - } - - @Override - public void onLoggingImpression(Ad ad) { - if (onLoadBannerFacebook != null) { - onLoadBannerFacebook.onLoggingImpression(); - } - } - }; - adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); - break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); - break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); - AdRequest adRequestProps = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequestProps); - break; - case "ADMOB": - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - adViewAdmob.setAdSize(AdSize.MEDIUM_RECTANGLE); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdOpened() { - - } - - @Override - public void onAdClicked() { - - } - - @Override - public void onAdClosed() { - - } - }); - break; - } - } - - @Override - public void onBannerLeftApplication(BannerView bannerView) { - - } - }); - } - - public static void MediumBannerAlienMediation(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBanner); - AdRequest adRequest = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequest); - adView.setAdListener(new AdListener() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - super.onAdFailedToLoad(loadAdError); - switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; - case "STARTAPP": - startAppMrec = new Mrec(activity, new BannerListener() { - @Override - public void onReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onFailedToReceiveAd(""); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onImpression(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onImpression(); - } - } - - @Override - public void onClick(View view) { - if (onLoadBannerStartApp != null) { - onLoadBannerStartApp.onClick(); - } - } - }); - RelativeLayout.LayoutParams bannerParameters = - new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); - layAds.addView(startAppMrec, bannerParameters); - break; - - case "UNITY": - unityBanner = new BannerView(activity, idBannerBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layAds.addView(unityBanner); - break; - case "ADMOB": - - AdRequest request = new AdRequest.Builder() - .build(); - adViewAdmob = new AdView(activity); - adViewAdmob.setAdUnitId(idBannerBackup); - layAds.addView(adViewAdmob); - adViewAdmob.setAdSize(AdSize.MEDIUM_RECTANGLE); - adViewAdmob.loadAd(request); - adViewAdmob.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdOpened(); - } - } - - @Override - public void onAdClicked() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClicked(); - } - } - - @Override - public void onAdClosed() { - if (onLoadBannerAdmob != null) { - onLoadBannerAdmob.onAdClosed(); - } - } - }); - break; - case "GOOGLE-ADS": - AdManagerAdRequest adRequest = - new AdManagerAdRequest.Builder() - .build(); - - bannerGoogleAds = new AdManagerAdView(activity); - bannerGoogleAds.setAdUnitId(idBannerBackup); - layAds.addView(bannerGoogleAds); - bannerGoogleAds.setAdSize(AdSize.MEDIUM_RECTANGLE); - bannerGoogleAds.loadAd(adRequest); - bannerGoogleAds.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdLoaded(); - } - - } - - @Override - public void onAdFailedToLoad(LoadAdError adError) { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdFailedToLoad(""); - } - layAds.setVisibility(View.GONE); - - } - - @Override - public void onAdOpened() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdOpened(); + onLoadBannerStartApp.onFailedToReceiveAd(""); } + layAds.setVisibility(View.GONE); } @Override - public void onAdClicked() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClicked(); + public void onImpression(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onImpression(); } } @Override - public void onAdClosed() { - if (onLoadBannerGoogle != null) { - onLoadBannerGoogle.onAdClosed(); + public void onClick(View view) { + if (onLoadBannerStartApp != null) { + onLoadBannerStartApp.onClick(); } } }); + RelativeLayout.LayoutParams bannerParameters = + new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); + layAds.addView(startAppMrec, bannerParameters); break; case "FACEBOOK": adViewFAN = new com.facebook.ads.AdView(activity, idBannerBackup, @@ -3511,319 +1053,71 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - case "ALIEN-V": - jamboxBanner = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { + case "ALIEN-M": + PropsAdsManagement propsAds = new PropsAdsManagement(activity); + AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); + AdRequest adRequestProps = new AdRequest.Builder().build(); + layAds.addView(adView); + adView.loadAd(adRequestProps); + break; + case "ADMOB": + AdRequest request = new AdRequest.Builder() + .build(); + adViewAdmob = new AdView(activity); + adViewAdmob.setAdUnitId(idBannerBackup); + layAds.addView(adViewAdmob); + adViewAdmob.setAdSize(AdSize.MEDIUM_RECTANGLE); + adViewAdmob.loadAd(request); + adViewAdmob.setAdListener(new AdListener() { @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } + public void onAdLoaded() { - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } } @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } + public void onAdFailedToLoad(LoadAdError adError) { + layAds.setVisibility(View.GONE); } @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } + public void onAdOpened() { - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } } @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); + public void onAdClicked() { + } @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); + public void onAdClosed() { + } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); + }); break; } } @Override - public void onAdLoaded() { - super.onAdLoaded(); - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "STARTAPP": - startAppBanner.hideBanner(); - break; - case "ALIEN-V": - if (jamboxBanner != null) { - jamboxBanner.destroy(); - } - break; - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; + public void onBannerLeftApplication(BannerView bannerView) { - } } }); - - } - - public static void MediumBannerWotrise(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - } - public static void MediumBannerAlienView(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { - - jamboxBanner = new MaxAdView(idBanner, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listenerJambox = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - - switch (selectAdsBackup) { - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "APPLOVIN-M": - if (adViewMax != null) { - adViewMax.destroy(); - } - break; - case "STARTAPP": - startAppBanner.hideBanner(); - break; - case "UNITY": - if (unityBanner != null) { - unityBanner.destroy(); - } - break; - case "ADMOB": - if (adViewAdmob != null) { - adViewAdmob.destroy(); - } - break; - case "GOOGLE-ADS": - if (bannerGoogleAds != null) { - bannerGoogleAds.destroy(); - } - break; - case "FACEBOOK": - if (adViewFAN != null) { - adViewFAN.destroy(); - } - break; - - } - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } + public static void MediumBannerAlienMediation(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + PropsAdsManagement propsAds = new PropsAdsManagement(activity); + AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBanner); + AdRequest adRequest = new AdRequest.Builder().build(); + layAds.addView(adView); + adView.loadAd(adRequest); + adView.setAdListener(new AdListener() { @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } + public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { + super.onAdFailedToLoad(loadAdError); switch (selectAdsBackup) { - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idBannerBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - AppLovinAdLoadListener loadListener = new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd ad) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.adReceived(); - } - - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadBannerApplovinDiscovery != null) { - onLoadBannerApplovinDiscovery.failedToReceiveAd(); - } - layAds.setVisibility(View.GONE); - - } - }; - adViewDiscovery.setAdLoadListener(loadListener); - layAds.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - ; - break; - case "APPLOVIN-M": - adViewMax = new MaxAdView(idBannerBackup, MaxAdFormat.MREC, activity); - MaxAdViewAdListener listener = new MaxAdViewAdListener() { - @Override - public void onAdExpanded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdExpanded(); - } - } - - @Override - public void onAdCollapsed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdCollapsed(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdLoadFailed(); - } - layAds.setVisibility(View.GONE); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); - } - layAds.setVisibility(View.GONE); - } - }; - adViewMax.setListener(listener); - adViewMax.stopAutoRefresh(); - final int widthPx = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPx = AppLovinSdkUtils.dpToPx(activity, 250); - adViewMax.setLayoutParams(new ConstraintLayout.LayoutParams(widthPx, heightPx)); - layAds.addView(adViewMax); - adViewMax.loadAd(); - break; case "STARTAPP": startAppMrec = new Mrec(activity, new BannerListener() { @Override @@ -4006,34 +1300,48 @@ public void onLoggingImpression(Ad ad) { }; adViewFAN.loadAd(adViewFAN.buildLoadAdConfig().withAdListener(adListener).build()); break; - case "ALIEN-M": - PropsAdsManagement propsAds = new PropsAdsManagement(activity); - AdView adView = propsAds.createBannerAdview("MEDIUM_RECTANGLE", idBannerBackup); - AdRequest adRequestProps = new AdRequest.Builder().build(); - layAds.addView(adView); - adView.loadAd(adRequestProps); - break; } } @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadBannerApplovinMax != null) { - onLoadBannerApplovinMax.onAdDisplayFailed(); + public void onAdLoaded() { + super.onAdLoaded(); + switch (selectAdsBackup) { + case "STARTAPP": + startAppBanner.hideBanner(); + break; + case "UNITY": + if (unityBanner != null) { + unityBanner.destroy(); + } + break; + case "ADMOB": + if (adViewAdmob != null) { + adViewAdmob.destroy(); + } + break; + case "GOOGLE-ADS": + if (bannerGoogleAds != null) { + bannerGoogleAds.destroy(); + } + break; + case "FACEBOOK": + if (adViewFAN != null) { + adViewFAN.destroy(); + } + break; + } - layAds.setVisibility(View.GONE); } - }; - jamboxBanner.setListener(listenerJambox); - jamboxBanner.stopAutoRefresh(); - final int widthPxJambox = AppLovinSdkUtils.dpToPx(activity, 300); - final int heightPxJambox = AppLovinSdkUtils.dpToPx(activity, 250); - jamboxBanner.setLayoutParams(new ConstraintLayout.LayoutParams(widthPxJambox, heightPxJambox)); - layAds.addView(jamboxBanner); - jamboxBanner.loadAd(); + }); + + } + public static void MediumBannerWotrise(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { + } + public static void MediumBannerAlienView(Activity activity, RelativeLayout layAds, String selectAdsBackup, String idBanner, String idBannerBackup) { } diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidNative.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidNative.java index cd5f344..7ea89c4 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidNative.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidNative.java @@ -1,7 +1,6 @@ package com.aliendroid.alienads; import android.app.Activity; -import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -15,7 +14,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.aliendroid.alienads.config.AppLovinCustomEventBanner; import com.aliendroid.alienads.interfaces.natives.OnLoadMediumNativesAdmob; import com.aliendroid.alienads.interfaces.natives.OnLoadMediumNativesAlien; import com.aliendroid.alienads.interfaces.natives.OnLoadMediumNativesApplovinMax; @@ -26,17 +24,6 @@ import com.aliendroid.alienads.interfaces.natives.OnLoadSmallNativesApplovinMax; import com.aliendroid.alienads.interfaces.natives.OnLoadSmallNativesFacebook; import com.aliendroid.alienads.interfaces.natives.OnLoadSmallNativesStartApp; -import com.applovin.adview.AppLovinAdView; -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxAdRevenueListener; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.nativeAds.MaxNativeAdListener; -import com.applovin.mediation.nativeAds.MaxNativeAdLoader; -import com.applovin.mediation.nativeAds.MaxNativeAdView; -import com.applovin.mediation.nativeAds.MaxNativeAdViewBinder; -import com.applovin.sdk.AppLovinAdSize; -import com.applovin.sdk.AppLovinSdkUtils; - import com.bumptech.glide.Glide; import com.facebook.ads.Ad; import com.facebook.ads.AdError; @@ -53,7 +40,6 @@ import com.google.android.gms.ads.nativead.NativeAd; import com.google.android.gms.ads.nativead.NativeAdOptions; import com.google.android.gms.ads.nativead.NativeAdView; - import com.props.adsmanager.PropsAdsManagement; import com.startapp.sdk.ads.nativead.NativeAdDetails; import com.startapp.sdk.ads.nativead.StartAppNativeAd; @@ -61,23 +47,15 @@ import com.unity3d.services.banners.BannerView; import com.unity3d.services.banners.UnityBannerSize; - import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class AliendroidNative { public static BannerView unityBanner; - public static AppLovinAdView adViewDiscovery; private static NativeAd nativeAdProps; private static NativeAd nativeAd; private static NativeAd nativeAd2; - private static MaxNativeAdLoader nativeAdLoader; - private static MaxNativeAdView nativeAdView; - private static MaxAd nativeAdMax; - private static MaxNativeAdLoader jamboxNativeAdLoader; - private static MaxNativeAdView jamboxNativeAdView; - private static MaxAd jamboxNativeAdMax; private static NativeAdLayout nativeAdLayout; private static LinearLayout adView; private static NativeBannerAd nativeBannerAd; @@ -111,11 +89,6 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { nativeAd.destroy(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - break; case "UNITY": if (unityBanner !=null){ unityBanner.destroy(); @@ -123,12 +96,6 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { break; case "STARTAPP": - - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } break; case "FACEBOOK": if (nativeBannerAd != null) { @@ -136,9 +103,6 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { } break; case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } break; } @@ -171,54 +135,6 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { onLoadSmallNativesAdmob.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "APPLOVIN-M": - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; case "UNITY": unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -259,19 +175,6 @@ public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { startAppNativeAd.loadAd(adListener); layNative.addView(adViewNative); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; case "FACEBOOK": nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); NativeAdListener nativeAdListener = new NativeAdListener() { @@ -346,52 +249,7 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { adLoader2.loadAd(request2); break; case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); break; case "ADMOB": AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); @@ -560,60 +418,6 @@ public void onLoggingImpression(Ad ad) { .withAdListener(nativeAdListener) .build()); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "APPLOVIN-M": - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; case "STARTAPP": startAppNativeAd = new StartAppNativeAd(activity); View adViewNative = (View) activity.getLayoutInflater() @@ -650,52 +454,7 @@ public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { layNative.addView(adViewNative); break; case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); break; } } @@ -706,43 +465,64 @@ public void onNativeAdClicked(final MaxAd ad) { } public static void SmallNativeAlienView(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); + } - jamboxNativeAdLoader = new MaxNativeAdLoader(nativeId, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { + public static void SmallNativeMax(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { + } - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); + public static void SmallNativeFan(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + nativeBannerAd = new NativeBannerAd(activity, nativeId); + NativeAdListener nativeAdListener = new NativeAdListener() { + @Override + public void onMediaDownloaded(Ad ad) { + if (onLoadSmallNativesFacebook != null) { + onLoadSmallNativesFacebook.onMediaDownloaded(); } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); } @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { + public void onError(Ad ad, AdError adError) { + if (onLoadSmallNativesFacebook != null) { + onLoadSmallNativesFacebook.onError(""); + } switch (selectAdsBackup) { + case "FACEBOOK": + nativeBannerAd2 = new NativeBannerAd(activity, idNativeBackup); + NativeAdListener nativeAdListener = new NativeAdListener() { + @Override + public void onMediaDownloaded(Ad ad) { + + } + + @Override + public void onError(Ad ad, AdError adError) { + + } + + @Override + public void onAdLoaded(Ad ad) { + if (nativeBannerAd2 == null || nativeBannerAd2 != ad) { + return; + } + inflateAd(nativeBannerAd2, activity, layNative); + } + + @Override + public void onAdClicked(Ad ad) { + + } + + @Override + public void onLoggingImpression(Ad ad) { + + } + }; + nativeBannerAd2.loadAd( + nativeBannerAd2.buildLoadAdConfig() + .withAdListener(nativeAdListener) + .build()); + break; case "ADMOB": AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @@ -791,96 +571,7 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { unityBanner.load(); layNative.addView(unityBanner); break; - case "FACEBOOK": - nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeBannerAd == null || nativeBannerAd != ad) { - return; - } - inflateAd(nativeBannerAd, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - nativeBannerAd.loadAd( - nativeBannerAd.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "APPLOVIN-M": - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - nativeAdLoader.loadAd(nativeAdView); - break; case "STARTAPP": startAppNativeAd = new StartAppNativeAd(activity); View adViewNative = (View) activity.getLayoutInflater() @@ -953,92 +644,91 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { .build(); adLoader2.loadAd(request2); break; - } - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { + case "ALIEN-V": + break; + } } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - - - } - - public static void SmallNativeMax(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(nativeId, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (onLoadSmallNativesApplovinMax != null) { - onLoadSmallNativesApplovinMax.onNativeAdLoaded(); + public void onAdLoaded(Ad ad) { + if (onLoadSmallNativesFacebook != null) { + onLoadSmallNativesFacebook.onAdLoaded(); } switch (selectAdsBackup) { - case "ADMOB": - if (nativeAd != null) { - nativeAd.destroy(); - } - break; case "UNITY": if (unityBanner !=null){ unityBanner.destroy(); } break; - case "STARTAPP": - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "FACEBOOK": - if (nativeBannerAd != null) { - nativeBannerAd.destroy(); + case "ADMOB": + if (nativeAd != null) { + nativeAd.destroy(); } break; case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } break; } + if (nativeBannerAd == null || nativeBannerAd != ad) { + return; + } + inflateAd(nativeBannerAd, activity, layNative); + } + + @Override + public void onAdClicked(Ad ad) { + + } + + @Override + public void onLoggingImpression(Ad ad) { + + } + }; + nativeBannerAd.loadAd( + nativeBannerAd.buildLoadAdConfig() + .withAdListener(nativeAdListener) + .build()); + } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); + public static void SmallNativeStartApp(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + startAppNativeAd = new StartAppNativeAd(activity); + View adViewNative = (View) activity.getLayoutInflater() + .inflate(R.layout.startapp_small_native, null); + AdEventListener adListener = new AdEventListener() { + @Override + public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { + if (onLoadSmallNativesStartApp != null) { + onLoadSmallNativesStartApp.onReceiveAd(); + } + ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list + Iterator iterator = ads.iterator(); + while (iterator.hasNext()) { + Log.d("MyApplication", iterator.next().toString()); + } + NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); + if (adDetails != null) { + TextView title = adViewNative.findViewById(R.id.ad_headline); + title.setText(adDetails.getTitle()); + ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); + Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); + TextView description = adViewNative.findViewById(R.id.ad_body); + description.setText(adDetails.getDescription()); + Button open = adViewNative.findViewById(R.id.ad_call_to_action); + open.setText(adDetails.isApp() ? "Install" : "Open"); + adDetails.registerViewForInteraction(adViewNative); } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); } @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - if (onLoadSmallNativesApplovinMax != null) { - onLoadSmallNativesApplovinMax.onNativeAdLoadFailed(""); + public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { + if (onLoadSmallNativesStartApp != null) { + onLoadSmallNativesStartApp.onFailedToReceiveAd(""); } switch (selectAdsBackup) { + case "ADMOB": AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @@ -1088,53 +778,6 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { layNative.addView(unityBanner); break; - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_small_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; case "FACEBOOK": nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); NativeAdListener nativeAdListener = new NativeAdListener() { @@ -1209,139 +852,80 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { adLoader2.loadAd(request2); break; case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); break; } } - @Override - public void onNativeAdClicked(final MaxAd ad) { - if (onLoadSmallNativesApplovinMax != null) { - onLoadSmallNativesApplovinMax.onNativeAdClicked(); - } - } - }); + }; + startAppNativeAd.loadAd(adListener); + layNative.addView(adViewNative); + } - nativeAdLoader.loadAd(nativeAdView); + public static void SmallNativeWortise(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup + ) { } - public static void SmallNativeFan(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - nativeBannerAd = new NativeBannerAd(activity, nativeId); - NativeAdListener nativeAdListener = new NativeAdListener() { + public static void MediumNativeStartApp(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + startAppNativeAd = new StartAppNativeAd(activity); + View adViewNative = (View) activity.getLayoutInflater() + .inflate(R.layout.startapp_medium_native, null); + AdEventListener adListener = new AdEventListener() { @Override - public void onMediaDownloaded(Ad ad) { - if (onLoadSmallNativesFacebook != null) { - onLoadSmallNativesFacebook.onMediaDownloaded(); + public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { + if (onLoadMediumNativesStartApp != null) { + onLoadMediumNativesStartApp.onReceiveAd(); + } + ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list + Iterator iterator = ads.iterator(); + while (iterator.hasNext()) { + Log.d("MyApplication", iterator.next().toString()); + } + NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); + if (adDetails != null) { + TextView title = adViewNative.findViewById(R.id.ad_headline); + title.setText(adDetails.getTitle()); + ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); + Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); + ImageView details = adViewNative.findViewById(R.id.imgDetail); + //Glide.with(activity).load(adDetails.getImageUrl()).centerCrop().fit().into(details); + Glide.with(activity).load(adDetails.getImageUrl()).into(details); + TextView description = adViewNative.findViewById(R.id.ad_body); + description.setText(adDetails.getDescription()); + Button open = adViewNative.findViewById(R.id.ad_call_to_action); + open.setText(adDetails.isApp() ? "Install" : "Open"); + adDetails.registerViewForInteraction(adViewNative); } } @Override - public void onError(Ad ad, AdError adError) { - if (onLoadSmallNativesFacebook != null) { - onLoadSmallNativesFacebook.onError(""); + public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { + if (onLoadMediumNativesStartApp != null) { + onLoadMediumNativesStartApp.onFailedToReceiveAd(""); } switch (selectAdsBackup) { + case "ALIEN-V": - case "FACEBOOK": - nativeBannerAd2 = new NativeBannerAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeBannerAd2 == null || nativeBannerAd2 != ad) { - return; - } - inflateAd(nativeBannerAd2, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - nativeBannerAd2.loadAd( - nativeBannerAd2.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); break; - case "ADMOB": - AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); - builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { + case "ADMOB": { + AdLoader.Builder builder = new AdLoader.Builder(activity, idNativeBackup); + builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @Override public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd != null) { nativeAd.destroy(); } - nativeAd = nativeAds; NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_native, null); + .inflate(R.layout.admob_big_native, null); populateNativeAdView(nativeAds, adView); layNative.removeAllViews(); layNative.addView(adView); } + }); + VideoOptions videoOptions = new VideoOptions.Builder() .build(); @@ -1349,13 +933,13 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { .setVideoOptions(videoOptions) .build(); - builder2.withNativeAdOptions(adOptions); + builder.withNativeAdOptions(adOptions); AdRequest request = new AdRequest.Builder() .build(); AdLoader adLoader = - builder2 + builder .withAdListener( new AdListener() { @Override @@ -1366,100 +950,49 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { .build(); adLoader.loadAd(request); break; + } case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); + unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); unityBanner.load(); layNative.addView(unityBanner); break; - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_small_native, null); - AdEventListener adListener = new AdEventListener() { + case "FACEBOOK": + nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); + NativeAdListener nativeAdListener = new NativeAdListener() { @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } + public void onMediaDownloaded(Ad ad) { + } @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { + public void onError(Ad ad, AdError adError) { } - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "APPLOVIN-M": - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); + public void onAdLoaded(Ad ad) { + if (nativeAdfan == null || nativeAdfan != ad) { + return; } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); + inflateAd2(nativeAdfan, activity, layNative); } @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { + public void onAdClicked(Ad ad) { } @Override - public void onNativeAdClicked(final MaxAd ad) { + public void onLoggingImpression(Ad ad) { } - }); + }; - nativeAdLoader.loadAd(nativeAdView); + nativeAdfan.loadAd( + nativeAdfan.buildLoadAdConfig() + .withAdListener(nativeAdListener) + .build()); break; case "ALIEN-M": String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); @@ -1472,7 +1005,7 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { } nativeAdProps = nativeAds; NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_native, null); + .inflate(R.layout.admob_big_native, null); populateNativeAdViewProps(nativeAds, adView); layNative.removeAllViews(); layNative.addView(adView); @@ -1498,218 +1031,278 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { .build(); adLoader2.loadAd(request2); break; - case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - break; } } + }; + startAppNativeAd.loadAd(adListener); + layNative.addView(adViewNative); + } + + public static void MediumNativeAdmob(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup, String Hpk1, + String Hpk2, String Hpk3, String Hpk4, String Hpk5) { + + AdLoader.Builder builder = new AdLoader.Builder(activity, nativeId); + builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @Override - public void onAdLoaded(Ad ad) { - if (onLoadSmallNativesFacebook != null) { - onLoadSmallNativesFacebook.onAdLoaded(); + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (onLoadMediumNativesAdmob != null) { + onLoadMediumNativesAdmob.onNativeAdLoaded(); + } + if (nativeAd != null) { + nativeAd.destroy(); } switch (selectAdsBackup) { - case "APPLOVIN-M": - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - break; - case "UNITY": - if (unityBanner !=null){ - unityBanner.destroy(); - } - break; - case "STARTAPP": break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "ADMOB": - if (nativeAd != null) { - nativeAd.destroy(); - } - break; - case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); + case "FACEBOOK": + if (nativeAdfan != null) { + nativeAdfan.destroy(); } break; - } - if (nativeBannerAd == null || nativeBannerAd != ad) { - return; - } - inflateAd(nativeBannerAd, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - nativeBannerAd.loadAd( - nativeBannerAd.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - } - public static void SmallNativeStartApp(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_small_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - if (onLoadSmallNativesStartApp != null) { - onLoadSmallNativesStartApp.onReceiveAd(); - } - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); } + nativeAd = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_big_native, null); + populateNativeAdView(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); } - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - if (onLoadSmallNativesStartApp != null) { - onLoadSmallNativesStartApp.onFailedToReceiveAd(""); - } - switch (selectAdsBackup) { - case "ADMOB": - AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); - builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + }); - if (nativeAd != null) { - nativeAd.destroy(); - } + VideoOptions videoOptions = new VideoOptions.Builder() + .build(); - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } + NativeAdOptions adOptions = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions) + .build(); - }); - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); + builder.withNativeAdOptions(adOptions); - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); + AdRequest request = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) + .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5) + .build(); + AdLoader adLoader = + builder + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + if (onLoadMediumNativesAdmob != null) { + onLoadMediumNativesAdmob.onAdFailedToLoad(""); + } + switch (selectAdsBackup) { + case "UNITY": + unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); + unityBanner.load(); + layNative.addView(unityBanner); + break; + case "STARTAPP": + startAppNativeAd = new StartAppNativeAd(activity); + View adViewNative = (View) activity.getLayoutInflater() + .inflate(R.layout.startapp_medium_native, null); + AdEventListener adListener = new AdEventListener() { + @Override + public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { + ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list + Iterator iterator = ads.iterator(); + while (iterator.hasNext()) { + Log.d("MyApplication", iterator.next().toString()); + } + NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); + if (adDetails != null) { + TextView title = adViewNative.findViewById(R.id.ad_headline); + title.setText(adDetails.getTitle()); + ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); + Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); + ImageView details = adViewNative.findViewById(R.id.imgDetail); + Glide.with(activity).load(adDetails.getImageUrl()).into(details); + TextView description = adViewNative.findViewById(R.id.ad_body); + description.setText(adDetails.getDescription()); + Button open = adViewNative.findViewById(R.id.ad_call_to_action); + open.setText(adDetails.isApp() ? "Install" : "Open"); + adDetails.registerViewForInteraction(adViewNative); + } + } - builder2.withNativeAdOptions(adOptions); + @Override + public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { + } - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder2 - .withAdListener( - new AdListener() { + }; + startAppNativeAd.loadAd(adListener); + layNative.addView(adViewNative); + break; + case "FACEBOOK": + nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); + NativeAdListener nativeAdListener = new NativeAdListener() { @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { + public void onMediaDownloaded(Ad ad) { } - }) - .build(); - adLoader.loadAd(request); - break; - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - case "FACEBOOK": - nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { + @Override + public void onError(Ad ad, AdError adError) { - } + } - @Override - public void onError(Ad ad, AdError adError) { + @Override + public void onAdLoaded(Ad ad) { + if (nativeAdfan == null || nativeAdfan != ad) { + return; + } + inflateAd2(nativeAdfan, activity, layNative); + } + + @Override + public void onAdClicked(Ad ad) { + + } + + @Override + public void onLoggingImpression(Ad ad) { + + } + }; + + nativeAdfan.loadAd( + nativeAdfan.buildLoadAdConfig() + .withAdListener(nativeAdListener) + .build()); + + break; + case "ALIEN-M": + String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); + AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); + builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { + @Override + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (nativeAdProps != null) { + nativeAdProps.destroy(); + } + nativeAdProps = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_big_native, null); + populateNativeAdViewProps(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); + } + }); + VideoOptions videoOptions2 = new VideoOptions.Builder() + .build(); + NativeAdOptions adOptions2 = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions2) + .build(); + builder3.withNativeAdOptions(adOptions2); + AdRequest request2 = new AdRequest.Builder() + .build(); + AdLoader adLoader2 = + builder3 + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + } + }) + .build(); + adLoader2.loadAd(request2); + break; + case "ADMOB": + AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); + builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { + @Override + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (nativeAd2 != null) { + nativeAd2.destroy(); + } + nativeAd2 = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_big_native, null); + populateNativeAdView(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); + } + + + }); + + VideoOptions videoOptions = new VideoOptions.Builder() + .build(); + + NativeAdOptions adOptions = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions) + .build(); + + builder2.withNativeAdOptions(adOptions); + + + AdRequest request = new AdRequest.Builder() + .build(); + AdLoader adLoader = + builder2 + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + + } + }) + .build(); + adLoader.loadAd(request); + break; + } + } + }) + .build(); + adLoader.loadAd(request); + } + + public static void MediumNativeMax(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + } + + public static void MediumNativeFan(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + nativeAdfan = new com.facebook.ads.NativeAd(activity, nativeId); + NativeAdListener nativeAdListener = new NativeAdListener() { + @Override + public void onMediaDownloaded(Ad ad) { + if (onLoadMediumNativesFacebook != null) { + onLoadMediumNativesFacebook.onMediaDownloaded(); + } + } + + @Override + public void onError(Ad ad, AdError adError) { + if (onLoadMediumNativesFacebook != null) { + onLoadMediumNativesFacebook.onError(""); + } + switch (selectAdsBackup) { + case "ALIEN-V": + + break; + case "FACEBOOK": + nativeAdfan2 = new com.facebook.ads.NativeAd(activity, idNativeBackup); + NativeAdListener nativeAdListener = new NativeAdListener() { + @Override + public void onMediaDownloaded(Ad ad) { + + } + + @Override + public void onError(Ad ad, AdError adError) { } @Override public void onAdLoaded(Ad ad) { - if (nativeBannerAd == null || nativeBannerAd != ad) { + if (nativeAdfan2 == null || nativeAdfan2 != ad) { return; } - inflateAd(nativeBannerAd, activity, layNative); + inflateAd2(nativeAdfan2, activity, layNative); } @Override @@ -1722,64 +1315,98 @@ public void onLoggingImpression(Ad ad) { } }; - nativeBannerAd.loadAd( - nativeBannerAd.buildLoadAdConfig() + + nativeAdfan2.loadAd( + nativeAdfan2.buildLoadAdConfig() .withAdListener(nativeAdListener) .build()); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - boolean isTablet2 = AppLovinSdkUtils.isTablet(activity); - AppLovinAdSize adSize = isTablet2 ? AppLovinAdSize.LEADER : AppLovinAdSize.BANNER; - adViewDiscovery = new AppLovinAdView(adSize, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); + case "UNITY": + unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); + unityBanner.load(); + layNative.addView(unityBanner); break; - case "APPLOVIN-M": - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { + case "STARTAPP": + startAppNativeAd = new StartAppNativeAd(activity); + View adViewNative = (View) activity.getLayoutInflater() + .inflate(R.layout.startapp_medium_native, null); + AdEventListener adListener = new AdEventListener() { @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); + public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { + ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list + Iterator iterator = ads.iterator(); + while (iterator.hasNext()) { + Log.d("MyApplication", iterator.next().toString()); + } + NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); + if (adDetails != null) { + TextView title = adViewNative.findViewById(R.id.ad_headline); + title.setText(adDetails.getTitle()); + ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); + Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); + ImageView details = adViewNative.findViewById(R.id.imgDetail); + Glide.with(activity).load(adDetails.getImageUrl()).into(details); + TextView description = adViewNative.findViewById(R.id.ad_body); + description.setText(adDetails.getDescription()); + Button open = adViewNative.findViewById(R.id.ad_call_to_action); + open.setText(adDetails.isApp() ? "Install" : "Open"); + adDetails.registerViewForInteraction(adViewNative); } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); } @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { + public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { } + }; + startAppNativeAd.loadAd(adListener); + layNative.addView(adViewNative); + break; + case "ADMOB": + AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); + builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @Override - public void onNativeAdClicked(final MaxAd ad) { - + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (nativeAd != null) { + nativeAd.destroy(); + } + nativeAd = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_big_native, null); + populateNativeAdView(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); } + + }); - nativeAdLoader.loadAd(nativeAdView); + VideoOptions videoOptions = new VideoOptions.Builder() + .build(); + + NativeAdOptions adOptions = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions) + .build(); + + builder2.withNativeAdOptions(adOptions); + + + AdRequest request = new AdRequest.Builder() + .build(); + AdLoader adLoader = + builder2 + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + + } + }) + .build(); + adLoader.loadAd(request); + break; case "ALIEN-M": String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); @@ -1792,7 +1419,7 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { } nativeAdProps = nativeAds; NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_native, null); + .inflate(R.layout.admob_big_native, null); populateNativeAdViewProps(nativeAds, adView); layNative.removeAllViews(); layNative.addView(adView); @@ -1812,76 +1439,231 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { new AdListener() { @Override public void onAdFailedToLoad(LoadAdError loadAdError) { - } }) .build(); adLoader2.loadAd(request2); break; - case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_small_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } + } + } - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); + @Override + public void onAdLoaded(Ad ad) { + if (onLoadMediumNativesFacebook != null) { + onLoadMediumNativesFacebook.onAdLoaded(); + } + switch (selectAdsBackup) { + case "ADMOB": + if (nativeAd != null) { + nativeAd.destroy(); + } + break; + case "STARTAPP": break; } + if (nativeAdfan == null || nativeAdfan != ad) { + return; + } + inflateAd2(nativeAdfan, activity, layNative); + } + + @Override + public void onAdClicked(Ad ad) { + } + @Override + public void onLoggingImpression(Ad ad) { + + } }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); + + nativeAdfan.loadAd( + nativeAdfan.buildLoadAdConfig() + .withAdListener(nativeAdListener) + .build()); + } - public static void SmallNativeWortise(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup - ) { + public static void MediumNativeAlien(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + + String getNativeId = PropsAdsManagement.getNativeAdsId(nativeId); + AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); + builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { + @Override + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (nativeAdProps != null) { + nativeAdProps.destroy(); + } + nativeAdProps = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_big_native, null); + populateNativeAdViewProps(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); + } + }); + VideoOptions videoOptions2 = new VideoOptions.Builder() + .build(); + NativeAdOptions adOptions2 = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions2) + .build(); + builder3.withNativeAdOptions(adOptions2); + AdRequest request2 = new AdRequest.Builder() + .build(); + AdLoader adLoader2 = + builder3 + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + switch (selectAdsBackup) { + case "UNITY": + unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); + unityBanner.load(); + layNative.addView(unityBanner); + break; + case "STARTAPP": + startAppNativeAd = new StartAppNativeAd(activity); + View adViewNative = (View) activity.getLayoutInflater() + .inflate(R.layout.startapp_medium_native, null); + AdEventListener adListener = new AdEventListener() { + @Override + public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { + ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list + Iterator iterator = ads.iterator(); + while (iterator.hasNext()) { + Log.d("MyApplication", iterator.next().toString()); + } + NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); + if (adDetails != null) { + TextView title = adViewNative.findViewById(R.id.ad_headline); + title.setText(adDetails.getTitle()); + ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); + Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); + ImageView details = adViewNative.findViewById(R.id.imgDetail); + Glide.with(activity).load(adDetails.getImageUrl()).into(details); + TextView description = adViewNative.findViewById(R.id.ad_body); + description.setText(adDetails.getDescription()); + Button open = adViewNative.findViewById(R.id.ad_call_to_action); + open.setText(adDetails.isApp() ? "Install" : "Open"); + adDetails.registerViewForInteraction(adViewNative); + } + } + + @Override + public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { + + } + + }; + startAppNativeAd.loadAd(adListener); + layNative.addView(adViewNative); + break; + case "ADMOB": + AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); + builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { + @Override + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (nativeAd != null) { + nativeAd.destroy(); + } + nativeAd = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_big_native, null); + populateNativeAdView(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); + } + + + }); + + VideoOptions videoOptions = new VideoOptions.Builder() + .build(); + + NativeAdOptions adOptions = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions) + .build(); + + builder2.withNativeAdOptions(adOptions); + + + AdRequest request = new AdRequest.Builder() + .build(); + AdLoader adLoader = + builder2 + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + + } + }) + .build(); + adLoader.loadAd(request); + + break; + case "FACEBOOK": + nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); + NativeAdListener nativeAdListener = new NativeAdListener() { + @Override + public void onMediaDownloaded(Ad ad) { + + } + + @Override + public void onError(Ad ad, AdError adError) { + + } + + @Override + public void onAdLoaded(Ad ad) { + if (nativeAdfan == null || nativeAdfan != ad) { + return; + } + inflateAd2(nativeAdfan, activity, layNative); + } + + @Override + public void onAdClicked(Ad ad) { + + } + + @Override + public void onLoggingImpression(Ad ad) { + + } + }; + + nativeAdfan.loadAd( + nativeAdfan.buildLoadAdConfig() + .withAdListener(nativeAdListener) + .build()); + break; + + case "ALIEN-V": + + break; + } + } + }) + .build(); + adLoader2.loadAd(request2); + } - public static void MediumNativeStartApp(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + public static void MediumNativeAlienView(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + } + + public static void MediumNativeWortise(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { + + } + + public static void SmallNativeStartAppRectangle(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { startAppNativeAd = new StartAppNativeAd(activity); View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_medium_native, null); + .inflate(R.layout.startapp_small_rectangle_native, null); AdEventListener adListener = new AdEventListener() { @Override public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { @@ -1916,55 +1698,7 @@ public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { onLoadMediumNativesStartApp.onFailedToReceiveAd(""); } switch (selectAdsBackup) { - case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - break; - case "ADMOB": { + case "ADMOB": AdLoader.Builder builder = new AdLoader.Builder(activity, idNativeBackup); builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @Override @@ -1974,7 +1708,7 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { } nativeAd = nativeAds; NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); + .inflate(R.layout.admob_small_rectangle_native, null); populateNativeAdView(nativeAds, adView); layNative.removeAllViews(); layNative.addView(adView); @@ -2007,15 +1741,14 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { .build(); adLoader.loadAd(request); break; - } case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); + unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); unityBanner.load(); layNative.addView(unityBanner); break; case "FACEBOOK": - nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); + nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); NativeAdListener nativeAdListener = new NativeAdListener() { @Override public void onMediaDownloaded(Ad ad) { @@ -2029,10 +1762,10 @@ public void onError(Ad ad, AdError adError) { @Override public void onAdLoaded(Ad ad) { - if (nativeAdfan == null || nativeAdfan != ad) { + if (nativeBannerAd == null || nativeBannerAd != ad) { return; } - inflateAd2(nativeAdfan, activity, layNative); + inflateAd3(nativeBannerAd, activity, layNative); } @Override @@ -2046,74 +1779,11 @@ public void onLoggingImpression(Ad ad) { } }; - nativeAdfan.loadAd( - nativeAdfan.buildLoadAdConfig() + nativeBannerAd.loadAd( + nativeBannerAd.buildLoadAdConfig() .withAdListener(nativeAdListener) .build()); break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - - case "APPLOVIN-M": - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - // Cleanup any pre-existing native ad to prevent memory leaks. - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - - // Save ad for cleanup. - nativeAdMax = ad; - - // Add ad view to view. - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; case "ALIEN-M": String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); @@ -2125,7 +1795,7 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { } nativeAdProps = nativeAds; NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); + .inflate(R.layout.admob_small_rectangle_native, null); populateNativeAdViewProps(nativeAds, adView); layNative.removeAllViews(); layNative.addView(adView); @@ -2145,7 +1815,6 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { new AdListener() { @Override public void onAdFailedToLoad(LoadAdError loadAdError) { - } }) .build(); @@ -2159,8 +1828,8 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { layNative.addView(adViewNative); } - public static void MediumNativeAdmob(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup, String Hpk1, - String Hpk2, String Hpk3, String Hpk4, String Hpk5) { + public static void SmallNativeAdmobRectangle(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup, String Hpk1, + String Hpk2, String Hpk3, String Hpk4, String Hpk5) { AdLoader.Builder builder = new AdLoader.Builder(activity, nativeId); builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @@ -2173,34 +1842,18 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { nativeAd.destroy(); } switch (selectAdsBackup) { - case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - break; - case "APPLOVIN-M": - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - break; case "STARTAPP": break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; case "FACEBOOK": if (nativeAdfan != null) { nativeAdfan.destroy(); } break; - } nativeAd = nativeAds; NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); + .inflate(R.layout.admob_small_rectangle_native, null); populateNativeAdView(nativeAds, adView); layNative.removeAllViews(); layNative.addView(adView); @@ -2231,116 +1884,15 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { onLoadMediumNativesAdmob.onAdFailedToLoad(""); } switch (selectAdsBackup) { - case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - break; - case "APPLOVIN-M": { - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - // Cleanup any pre-existing native ad to prevent memory leaks. - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - - // Save ad for cleanup. - nativeAdMax = ad; - - // Add ad view to view. - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - } case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); + unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); unityBanner.load(); layNative.addView(unityBanner); break; case "STARTAPP": startAppNativeAd = new StartAppNativeAd(activity); View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_medium_native, null); + .inflate(R.layout.startapp_small_rectangle_native, null); AdEventListener adListener = new AdEventListener() { @Override public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { @@ -2362,2092 +1914,143 @@ public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { Button open = adViewNative.findViewById(R.id.ad_call_to_action); open.setText(adDetails.isApp() ? "Install" : "Open"); adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - - case "FACEBOOK": - nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeAdfan == null || nativeAdfan != ad) { - return; - } - inflateAd2(nativeAdfan, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeAdfan.loadAd( - nativeAdfan.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - - break; - case "ALIEN-M": - String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - } - }) - .build(); - adLoader2.loadAd(request2); - break; - case "ADMOB": - AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); - builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd2 != null) { - nativeAd2.destroy(); - } - nativeAd2 = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder2.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder2 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - break; - } - } - }) - .build(); - adLoader.loadAd(request); - } - - public static void MediumNativeMax(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(nativeId, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (onLoadMediumNativesApplovinMax != null) { - onLoadMediumNativesApplovinMax.onNativeAdLoaded(); - } - switch (selectAdsBackup) { - case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - break; - case "ADMOB": - if (nativeAd != null) { - nativeAd.destroy(); - } - break; - case "STARTAPP": - - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "FACEBOOK": - if (nativeAdfan != null) { - nativeAdfan.destroy(); - } - break; - - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - if (onLoadMediumNativesApplovinMax != null) { - onLoadMediumNativesApplovinMax.onNativeAdLoadFailed(""); - } - switch (selectAdsBackup) { - case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - break; - case "ADMOB": - AdLoader.Builder builder = new AdLoader.Builder(activity, idNativeBackup); - builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd != null) { - nativeAd.destroy(); - } - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - break; - - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_medium_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - ImageView details = adViewNative.findViewById(R.id.imgDetail); - Glide.with(activity).load(adDetails.getImageUrl()).into(details); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - AdRequest.Builder builder2 = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder2.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - case "ALIEN-M": - String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - } - }) - .build(); - adLoader2.loadAd(request2); - break; - case "FACEBOOK": - nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeAdfan == null || nativeAdfan != ad) { - return; - } - inflateAd2(nativeAdfan, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeAdfan.loadAd( - nativeAdfan.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - - break; - } - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - if (onLoadMediumNativesApplovinMax != null) { - onLoadMediumNativesApplovinMax.onNativeAdClicked(); - } - } - }); - nativeAdLoader.loadAd(nativeAdView); - - } - - public static void MediumNativeFan(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - nativeAdfan = new com.facebook.ads.NativeAd(activity, nativeId); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - if (onLoadMediumNativesFacebook != null) { - onLoadMediumNativesFacebook.onMediaDownloaded(); - } - } - - @Override - public void onError(Ad ad, AdError adError) { - if (onLoadMediumNativesFacebook != null) { - onLoadMediumNativesFacebook.onError(""); - } - switch (selectAdsBackup) { - case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - break; - case "FACEBOOK": - nativeAdfan2 = new com.facebook.ads.NativeAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeAdfan2 == null || nativeAdfan2 != ad) { - return; - } - inflateAd2(nativeAdfan2, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeAdfan2.loadAd( - nativeAdfan2.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - break; - case "APPLOVIN-M": { - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAd != null) { - nativeAd.destroy(); - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - } - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_medium_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - ImageView details = adViewNative.findViewById(R.id.imgDetail); - Glide.with(activity).load(adDetails.getImageUrl()).into(details); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - - case "ADMOB": - AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); - builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd != null) { - nativeAd.destroy(); - } - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder2.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder2 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - - break; - case "ALIEN-M": - String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - } - }) - .build(); - adLoader2.loadAd(request2); - break; - } - } - - @Override - public void onAdLoaded(Ad ad) { - if (onLoadMediumNativesFacebook != null) { - onLoadMediumNativesFacebook.onAdLoaded(); - } - switch (selectAdsBackup) { - case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - break; - case "ADMOB": - if (nativeAd != null) { - nativeAd.destroy(); - } - break; - case "STARTAPP": - - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "APPLOVIN-M": - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - break; - - } - if (nativeAdfan == null || nativeAdfan != ad) { - return; - } - inflateAd2(nativeAdfan, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeAdfan.loadAd( - nativeAdfan.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - - } - - public static void MediumNativeAlien(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - - String getNativeId = PropsAdsManagement.getNativeAdsId(nativeId); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - switch (selectAdsBackup) { - case "APPLOVIN-M": { - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAd != null) { - nativeAd.destroy(); - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - } - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_medium_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - ImageView details = adViewNative.findViewById(R.id.imgDetail); - Glide.with(activity).load(adDetails.getImageUrl()).into(details); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - - case "ADMOB": - AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); - builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd != null) { - nativeAd.destroy(); - } - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder2.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder2 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - - break; - case "FACEBOOK": - nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeAdfan == null || nativeAdfan != ad) { - return; - } - inflateAd2(nativeAdfan, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeAdfan.loadAd( - nativeAdfan.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - break; - - case "ALIEN-V": - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - break; - } - } - }) - .build(); - adLoader2.loadAd(request2); - - } - - public static void MediumNativeAlienView(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - MaxNativeAdViewBinder binderJambox = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - jamboxNativeAdView = new MaxNativeAdView(binderJambox, activity); - - jamboxNativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - jamboxNativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - jamboxNativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - - jamboxNativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - switch (selectAdsBackup) { - case "APPLOVIN-M": { - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_big_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAd != null) { - nativeAd.destroy(); - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - } - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(300, 250)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_medium_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - ImageView details = adViewNative.findViewById(R.id.imgDetail); - Glide.with(activity).load(adDetails.getImageUrl()).into(details); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - AdRequest.Builder builder = new AdRequest.Builder(); - Bundle bannerExtras = new Bundle(); - bannerExtras.putString("zone_id", idNativeBackup); - builder.addCustomEventExtrasBundle(AppLovinCustomEventBanner.class, bannerExtras); - - adViewDiscovery = new AppLovinAdView(AppLovinAdSize.MREC, activity); - layNative.addView(adViewDiscovery); - adViewDiscovery.loadNextAd(); - break; - - case "ADMOB": - AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); - builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd != null) { - nativeAd.destroy(); - } - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder2.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder2 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - - break; - case "ALIEN-M": - String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_big_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - } - }) - .build(); - adLoader2.loadAd(request2); - break; - case "FACEBOOK": - nativeAdfan = new com.facebook.ads.NativeAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeAdfan == null || nativeAdfan != ad) { - return; - } - inflateAd2(nativeAdfan, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeAdfan.loadAd( - nativeAdfan.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - break; - } - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - jamboxNativeAdLoader.loadAd(jamboxNativeAdView); - - } - - public static void MediumNativeWortise(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - - } - - public static void SmallNativeStartAppRectangle(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_small_rectangle_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - if (onLoadMediumNativesStartApp != null) { - onLoadMediumNativesStartApp.onReceiveAd(); - } - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - ImageView details = adViewNative.findViewById(R.id.imgDetail); - //Glide.with(activity).load(adDetails.getImageUrl()).centerCrop().fit().into(details); - Glide.with(activity).load(adDetails.getImageUrl()).into(details); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - if (onLoadMediumNativesStartApp != null) { - onLoadMediumNativesStartApp.onFailedToReceiveAd(""); - } - switch (selectAdsBackup) { - case "ADMOB": - AdLoader.Builder builder = new AdLoader.Builder(activity, idNativeBackup); - builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd != null) { - nativeAd.destroy(); - } - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_rectangle_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - break; - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - - case "FACEBOOK": - nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeBannerAd == null || nativeBannerAd != ad) { - return; - } - inflateAd3(nativeBannerAd, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeBannerAd.loadAd( - nativeBannerAd.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - break; - case "APPLOVIN-D": - break; - case "APPLOVIN-M": - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_rectangle_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - // Cleanup any pre-existing native ad to prevent memory leaks. - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - - // Save ad for cleanup. - nativeAdMax = ad; - - // Add ad view to view. - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - case "ALIEN-M": - String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_rectangle_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - } - }) - .build(); - adLoader2.loadAd(request2); - break; - } - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - } - - public static void SmallNativeAdmobRectangle(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup, String Hpk1, - String Hpk2, String Hpk3, String Hpk4, String Hpk5) { - - AdLoader.Builder builder = new AdLoader.Builder(activity, nativeId); - builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (onLoadMediumNativesAdmob != null) { - onLoadMediumNativesAdmob.onNativeAdLoaded(); - } - if (nativeAd != null) { - nativeAd.destroy(); - } - switch (selectAdsBackup) { - case "APPLOVIN-M": - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - break; - case "STARTAPP": - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "FACEBOOK": - if (nativeAdfan != null) { - nativeAdfan.destroy(); - } - break; - case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - break; - - } - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_rectangle_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder.withNativeAdOptions(adOptions); - - AdRequest request = new AdRequest.Builder().addKeyword(Hpk1).addKeyword(Hpk2) - .addKeyword(Hpk3).addKeyword(Hpk4).addKeyword(Hpk5) - .build(); - AdLoader adLoader = - builder - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - if (onLoadMediumNativesAdmob != null) { - onLoadMediumNativesAdmob.onAdFailedToLoad(""); - } - switch (selectAdsBackup) { - case "APPLOVIN-M": { - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_rectangle_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - - if (nativeAd != null) { - nativeAd.destroy(); - } - // Cleanup any pre-existing native ad to prevent memory leaks. - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - - // Save ad for cleanup. - nativeAdMax = ad; - - // Add ad view to view. - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - } - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_small_rectangle_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - ImageView details = adViewNative.findViewById(R.id.imgDetail); - Glide.with(activity).load(adDetails.getImageUrl()).into(details); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } - - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - - } - - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": - break; - case "FACEBOOK": - nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - - } - - @Override - public void onError(Ad ad, AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - if (nativeBannerAd == null || nativeBannerAd != ad) { - return; - } - inflateAd3(nativeBannerAd, activity, layNative); - } - - @Override - public void onAdClicked(Ad ad) { - - } - - @Override - public void onLoggingImpression(Ad ad) { - - } - }; - - nativeBannerAd.loadAd( - nativeBannerAd.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); - - break; - case "ALIEN-M": - String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_rectangle_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - } - }) - .build(); - adLoader2.loadAd(request2); - break; - case "ADMOB": - AdLoader.Builder builder = new AdLoader.Builder(activity, idNativeBackup); - builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd2 != null) { - nativeAd2.destroy(); - } - nativeAd2 = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_rectangle_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - break; - } - } - }) - .build(); - adLoader.loadAd(request); - } - - public static void SmallNativeMaxRectangle(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { - - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_rectangle_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(nativeId, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (onLoadMediumNativesApplovinMax != null) { - onLoadMediumNativesApplovinMax.onNativeAdLoaded(); - } - switch (selectAdsBackup) { - case "ADMOB": - if (nativeAd != null) { - nativeAd.destroy(); - } - break; - case "STARTAPP": - - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "FACEBOOK": - if (nativeAdfan != null) { - nativeAdfan.destroy(); - } - break; - case "ALIEN-V": - if (jamboxNativeAdMax != null) { - jamboxNativeAdLoader.destroy(jamboxNativeAdMax); - } - break; - - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - if (onLoadMediumNativesApplovinMax != null) { - onLoadMediumNativesApplovinMax.onNativeAdLoadFailed(""); - } - switch (selectAdsBackup) { - case "ADMOB": { - AdLoader.Builder builder = new AdLoader.Builder(activity, idNativeBackup); - builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAd != null) { - nativeAd.destroy(); - } - nativeAd = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_rectangle_native, null); - populateNativeAdView(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - - - }); - - VideoOptions videoOptions = new VideoOptions.Builder() - .build(); - - NativeAdOptions adOptions = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions) - .build(); - - builder.withNativeAdOptions(adOptions); - - - AdRequest request = new AdRequest.Builder() - .build(); - AdLoader adLoader = - builder - .withAdListener( - new AdListener() { - @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { - - } - }) - .build(); - adLoader.loadAd(request); - break; - } - case "UNITY": - unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); - unityBanner.load(); - layNative.addView(unityBanner); - break; - - case "STARTAPP": - startAppNativeAd = new StartAppNativeAd(activity); - View adViewNative = (View) activity.getLayoutInflater() - .inflate(R.layout.startapp_small_rectangle_native, null); - AdEventListener adListener = new AdEventListener() { - @Override - public void onReceiveAd(@NonNull com.startapp.sdk.adsbase.Ad ad) { - ArrayList ads = startAppNativeAd.getNativeAds(); // get NativeAds list - Iterator iterator = ads.iterator(); - while (iterator.hasNext()) { - Log.d("MyApplication", iterator.next().toString()); - } - NativeAdDetails adDetails = (NativeAdDetails) ads.get(0); - if (adDetails != null) { - TextView title = adViewNative.findViewById(R.id.ad_headline); - title.setText(adDetails.getTitle()); - ImageView icon = adViewNative.findViewById(R.id.ad_app_icon); - Glide.with(activity).load(adDetails.getSecondaryImageUrl()).into(icon); - ImageView details = adViewNative.findViewById(R.id.imgDetail); - Glide.with(activity).load(adDetails.getImageUrl()).into(details); - TextView description = adViewNative.findViewById(R.id.ad_body); - description.setText(adDetails.getDescription()); - Button open = adViewNative.findViewById(R.id.ad_call_to_action); - open.setText(adDetails.isApp() ? "Install" : "Open"); - adDetails.registerViewForInteraction(adViewNative); - } - } + } + } - @Override - public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { + @Override + public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { - } + } - }; - startAppNativeAd.loadAd(adListener); - layNative.addView(adViewNative); - break; - case "APPLOVIN-D": + }; + startAppNativeAd.loadAd(adListener); + layNative.addView(adViewNative); + break; + case "FACEBOOK": + nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); + NativeAdListener nativeAdListener = new NativeAdListener() { + @Override + public void onMediaDownloaded(Ad ad) { + + } - break; - case "ALIEN-M": - String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); - AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); - builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { - @Override - public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { - if (nativeAdProps != null) { - nativeAdProps.destroy(); - } - nativeAdProps = nativeAds; - NativeAdView adView = (NativeAdView) activity.getLayoutInflater() - .inflate(R.layout.admob_small_rectangle_native, null); - populateNativeAdViewProps(nativeAds, adView); - layNative.removeAllViews(); - layNative.addView(adView); - } - }); - VideoOptions videoOptions2 = new VideoOptions.Builder() - .build(); - NativeAdOptions adOptions2 = new NativeAdOptions.Builder() - .setVideoOptions(videoOptions2) - .build(); - builder3.withNativeAdOptions(adOptions2); - AdRequest request2 = new AdRequest.Builder() - .build(); - AdLoader adLoader2 = - builder3 - .withAdListener( - new AdListener() { @Override - public void onAdFailedToLoad(LoadAdError loadAdError) { + public void onError(Ad ad, AdError adError) { + } - }) - .build(); - adLoader2.loadAd(request2); - break; - case "FACEBOOK": - nativeBannerAd = new NativeBannerAd(activity, idNativeBackup); - NativeAdListener nativeAdListener = new NativeAdListener() { - @Override - public void onMediaDownloaded(Ad ad) { - } + @Override + public void onAdLoaded(Ad ad) { + if (nativeBannerAd == null || nativeBannerAd != ad) { + return; + } + inflateAd3(nativeBannerAd, activity, layNative); + } - @Override - public void onError(Ad ad, AdError adError) { + @Override + public void onAdClicked(Ad ad) { - } + } - @Override - public void onAdLoaded(Ad ad) { - if (nativeBannerAd == null || nativeBannerAd != ad) { - return; - } - inflateAd3(nativeBannerAd, activity, layNative); - } + @Override + public void onLoggingImpression(Ad ad) { - @Override - public void onAdClicked(Ad ad) { + } + }; - } + nativeBannerAd.loadAd( + nativeBannerAd.buildLoadAdConfig() + .withAdListener(nativeAdListener) + .build()); - @Override - public void onLoggingImpression(Ad ad) { + break; + case "ALIEN-M": + String getNativeId = PropsAdsManagement.getNativeAdsId(idNativeBackup); + AdLoader.Builder builder3 = new AdLoader.Builder(activity, getNativeId); + builder3.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { + @Override + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (nativeAdProps != null) { + nativeAdProps.destroy(); + } + nativeAdProps = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_small_rectangle_native, null); + populateNativeAdViewProps(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); + } + }); + VideoOptions videoOptions2 = new VideoOptions.Builder() + .build(); + NativeAdOptions adOptions2 = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions2) + .build(); + builder3.withNativeAdOptions(adOptions2); + AdRequest request2 = new AdRequest.Builder() + .build(); + AdLoader adLoader2 = + builder3 + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + } + }) + .build(); + adLoader2.loadAd(request2); + break; + case "ADMOB": + AdLoader.Builder builder = new AdLoader.Builder(activity, idNativeBackup); + builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { + @Override + public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { + if (nativeAd2 != null) { + nativeAd2.destroy(); + } + nativeAd2 = nativeAds; + NativeAdView adView = (NativeAdView) activity.getLayoutInflater() + .inflate(R.layout.admob_small_rectangle_native, null); + populateNativeAdView(nativeAds, adView); + layNative.removeAllViews(); + layNative.addView(adView); + } - } - }; - nativeBannerAd.loadAd( - nativeBannerAd.buildLoadAdConfig() - .withAdListener(nativeAdListener) - .build()); + }); - break; - } - } + VideoOptions videoOptions = new VideoOptions.Builder() + .build(); - @Override - public void onNativeAdClicked(final MaxAd ad) { - if (onLoadMediumNativesApplovinMax != null) { - onLoadMediumNativesApplovinMax.onNativeAdClicked(); - } - } - }); - nativeAdLoader.loadAd(nativeAdView); + NativeAdOptions adOptions = new NativeAdOptions.Builder() + .setVideoOptions(videoOptions) + .build(); + + builder.withNativeAdOptions(adOptions); + + + AdRequest request = new AdRequest.Builder() + .build(); + AdLoader adLoader = + builder + .withAdListener( + new AdListener() { + @Override + public void onAdFailedToLoad(LoadAdError loadAdError) { + + } + }) + .build(); + adLoader.loadAd(request); + break; + } + } + }) + .build(); + adLoader.loadAd(request); + } + public static void SmallNativeMaxRectangle(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { } public static void SmallNativeFanRectangle(Activity activity, RelativeLayout layNative, String selectAdsBackup, String nativeId, String idNativeBackup) { @@ -4503,53 +2106,6 @@ public void onLoggingImpression(Ad ad) { .withAdListener(nativeAdListener) .build()); break; - case "APPLOVIN-M": { - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_rectangle_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAd != null) { - nativeAd.destroy(); - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - } case "UNITY": unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -4592,10 +2148,6 @@ public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { startAppNativeAd.loadAd(adListener); layNative.addView(adViewNative); break; - case "APPLOVIN-D": - - break; - case "ADMOB": AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { @@ -4692,19 +2244,7 @@ public void onAdLoaded(Ad ad) { } break; case "STARTAPP": - break; - case "APPLOVIN-D": - if (adViewDiscovery != null) { - adViewDiscovery.destroy(); - } - break; - case "APPLOVIN-M": - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - break; - } if (nativeBannerAd == null || nativeBannerAd != ad) { return; @@ -4763,53 +2303,6 @@ public void onNativeAdLoaded(@NonNull NativeAd nativeAds) { @Override public void onAdFailedToLoad(LoadAdError loadAdError) { switch (selectAdsBackup) { - case "APPLOVIN-M": { - MaxNativeAdViewBinder binder = new MaxNativeAdViewBinder.Builder(R.layout.max_small_rectangle_native) - .setTitleTextViewId(R.id.title_text_view) - .setBodyTextViewId(R.id.body_text_view) - .setAdvertiserTextViewId(R.id.advertiser_textView) - .setIconImageViewId(R.id.icon_image_view) - .setMediaContentViewGroupId(R.id.media_view_container) - .setOptionsContentViewGroupId(R.id.ad_options_view) - .setCallToActionButtonId(R.id.cta_button) - .build(); - nativeAdView = new MaxNativeAdView(binder, activity); - - nativeAdLoader = new MaxNativeAdLoader(idNativeBackup, activity); - nativeAdLoader.setRevenueListener(new MaxAdRevenueListener() { - @Override - public void onAdRevenuePaid(MaxAd ad) { - - } - }); - nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() { - @Override - public void onNativeAdLoaded(final MaxNativeAdView nativeAdView, final MaxAd ad) { - if (nativeAd != null) { - nativeAd.destroy(); - } - if (nativeAdMax != null) { - nativeAdLoader.destroy(nativeAdMax); - } - nativeAdMax = ad; - layNative.removeAllViews(); - layNative.addView(nativeAdView); - } - - @Override - public void onNativeAdLoadFailed(final String adUnitId, final MaxError error) { - - } - - @Override - public void onNativeAdClicked(final MaxAd ad) { - - } - }); - - nativeAdLoader.loadAd(nativeAdView); - break; - } case "UNITY": unityBanner = new BannerView(activity, idNativeBackup, new UnityBannerSize(320, 50)); unityBanner.load(); @@ -4852,10 +2345,6 @@ public void onFailedToReceiveAd(@Nullable com.startapp.sdk.adsbase.Ad ad) { startAppNativeAd.loadAd(adListener); layNative.addView(adViewNative); break; - case "APPLOVIN-D": - - break; - case "ADMOB": AdLoader.Builder builder2 = new AdLoader.Builder(activity, idNativeBackup); builder2.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidReward.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidReward.java index 8a2ac0c..9cfdaf0 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidReward.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/AliendroidReward.java @@ -12,24 +12,12 @@ import com.aliendroid.alienads.interfaces.rewards.load.OnLoadRewardsApplovinDiscovery; import com.aliendroid.alienads.interfaces.rewards.load.OnLoadRewardsApplovinMax; import com.aliendroid.alienads.interfaces.rewards.load.OnLoadRewardsGoogle; -import com.aliendroid.alienads.interfaces.rewards.load.OnLoadRewardsIronSource; import com.aliendroid.alienads.interfaces.rewards.load.OnLoadRewardsStartApp; import com.aliendroid.alienads.interfaces.rewards.show.OnShowRewardsAdmob; import com.aliendroid.alienads.interfaces.rewards.show.OnShowRewardsAlienMedition; import com.aliendroid.alienads.interfaces.rewards.show.OnShowRewardsAlienView; import com.aliendroid.alienads.interfaces.rewards.show.OnShowRewardsApplovinDiscovery; import com.aliendroid.alienads.interfaces.rewards.show.OnShowRewardsGoogle; -import com.applovin.adview.AppLovinIncentivizedInterstitial; -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.MaxReward; -import com.applovin.mediation.MaxRewardedAdListener; -import com.applovin.mediation.ads.MaxRewardedAd; -import com.applovin.sdk.AppLovinAd; -import com.applovin.sdk.AppLovinAdDisplayListener; -import com.applovin.sdk.AppLovinAdLoadListener; -import com.applovin.sdk.AppLovinAdRewardListener; -import com.applovin.sdk.AppLovinSdk; import com.facebook.ads.Ad; import com.facebook.ads.RewardedVideoAd; import com.google.android.gms.ads.AdRequest; @@ -48,17 +36,11 @@ import com.unity3d.ads.UnityAds; import com.unity3d.ads.UnityAdsShowOptions; - -import java.util.Map; - public class AliendroidReward { public static RewardedAd rewardedAdUnity; public static RewardedVideoAd rewardedVideoAdFan; public static RewardedVideoAd rewardedVideoAdFan2; - public static MaxRewardedAd rewardedAd; - public static MaxRewardedAd jamboxRewardedAd; public static boolean unlockreward = false; - public static AppLovinIncentivizedInterstitial incentivizedInterstitial; public static StartAppAd rewardedVideo; private static RewardedAd mRewardedAd; private static RewardedAd mRewardedAd2; @@ -126,59 +108,6 @@ public void onRewardedVideoClosed() { .build()); switch (selectBackupAds) { - - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - break; - case "UNITY": IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { @Override @@ -197,20 +126,6 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro e.printStackTrace(); } - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - - } - - @Override - public void failedToReceiveAd(int errorCode) { - - } - }); break; case "STARTAPP": rewardedVideo = new StartAppAd(activity); @@ -247,58 +162,6 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { } }); break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - case "ADMOB": AdRequest adRequest2 = new AdRequest.Builder() .build(); @@ -395,57 +258,6 @@ public void onAdLoaded(@NonNull RewardedAd rewardedAd) { } }); switch (selectBackupAds) { - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - break; case "UNITY": IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { @Override @@ -465,20 +277,6 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro } - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - - } - - @Override - public void failedToReceiveAd(int errorCode) { - - } - }); break; case "STARTAPP": rewardedVideo = new StartAppAd(activity); @@ -515,58 +313,6 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { } }); break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - case "ADMOB": AdRequest adRequest2 = new AdRequest.Builder() .build(); @@ -697,59 +443,6 @@ public void onRewardedVideoClosed() { .withAdListener(rewardedVideoAdListener2) .build()); break; - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - break; - - case "UNITY": IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { @Override @@ -768,20 +461,6 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro e.printStackTrace(); } - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - - } - - @Override - public void failedToReceiveAd(int errorCode) { - - } - }); break; case "STARTAPP": rewardedVideo = new StartAppAd(activity); @@ -828,116 +507,182 @@ public void onAdLoaded(@NonNull RewardedAd rewardedAd) { } }); break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } + } - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { + } catch (Exception e) { + e.printStackTrace(); + } - } + } - @Override - public void onAdLoaded(MaxAd ad) { + public static void LoadRewardAlienView(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { + } - } + public static void LoadRewardUnity(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { + IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { + @Override + public void onUnityAdsAdLoaded(String placementId) { - @Override - public void onAdDisplayed(MaxAd ad) { + } - } + @Override + public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - @Override - public void onAdHidden(MaxAd ad) { + } + }; + try { + UnityAds.load(idReward, loadListener); + } catch (Exception e) { + e.printStackTrace(); + } - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { + switch (selectBackupAds) { + case "ADMOB": + AdRequest adRequest = new AdRequest.Builder() + .build(); + RewardedAd.load(activity, idBackupReward, + adRequest, new RewardedAdLoadCallback() { + @Override + public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { + if (onLoadRewardsAdmob != null) { + onLoadRewardsAdmob.onAdFailedToLoad(); + } + mRewardedAd = null; + } - } + @Override + public void onAdLoaded(@NonNull RewardedAd rewardedAd) { + if (onLoadRewardsAdmob != null) { + onLoadRewardsAdmob.onAdLoaded(""); + } + mRewardedAd = rewardedAd; - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { + } + }); + break; + case "FACEBOOK": + rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); + com.facebook.ads.RewardedVideoAdListener rewardedVideoAdListener2 = new com.facebook.ads.RewardedVideoAdListener() { - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - } + @Override + public void onError(Ad ad, com.facebook.ads.AdError adError) { - } catch (Exception e) { - e.printStackTrace(); - } + } - } + @Override + public void onAdLoaded(Ad ad) { + // Rewarded video ad is loaded and ready to be displayed + Log.d(TAG, "Rewarded video ad is loaded and ready to be displayed!"); + } - public static void LoadRewardAlienView(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - try { - jamboxRewardedAd= MaxRewardedAd.getInstance(idReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { + @Override + public void onAdClicked(Ad ad) { + // Rewarded video ad clicked + Log.d(TAG, "Rewarded video ad clicked!"); + } - } + @Override + public void onLoggingImpression(Ad ad) { + // Rewarded Video ad impression - the event will fire when the + // video starts playing + Log.d(TAG, "Rewarded video ad impression logged!"); + } - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } + @Override + public void onRewardedVideoCompleted() { + unlockreward = true; + } - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { + @Override + public void onRewardedVideoClosed() { + // The Rewarded Video ad was closed - this can occur during the video + // by closing the app, or closing the end card. + Log.d(TAG, "Rewarded video ad closed!"); + } + }; + rewardedVideoAdFan.loadAd( + rewardedVideoAdFan.buildLoadAdConfig() + .withAdListener(rewardedVideoAdListener2) + .build()); + break; + case "UNITY": + IUnityAdsLoadListener loadListener2 = new IUnityAdsLoadListener() { + @Override + public void onUnityAdsAdLoaded(String placementId) { - } + } - @Override - public void onAdLoaded(MaxAd ad) { + @Override + public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { + } + }; + try { + UnityAds.load(idBackupReward, loadListener2); + } catch (Exception e) { + e.printStackTrace(); } - @Override - public void onAdDisplayed(MaxAd ad) { - - } + break; + case "STARTAPP": + rewardedVideo = new StartAppAd(activity); + rewardedVideo.setVideoListener(new VideoListener() { + @Override + public void onVideoCompleted() { + unlockreward = true; + } + }); - @Override - public void onAdHidden(MaxAd ad) { + rewardedVideo.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() { + @Override + public void onReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - } + } - @Override - public void onAdClicked(MaxAd ad) { + @Override + public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - } + } + }); + break; + case "ALIEN-M": + PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { + @Override + public void onAdLoaded(@NonNull RewardedAd rewardedAd) { + Log.i(TAG, "testing rewarded"); + } - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { + @Override + public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { + // Handle the error + } + }); + break; + } + } - } + public static void LoadRewardGoogleAds(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { + try { + AdManagerAdRequest adRequest = new AdManagerAdRequest.Builder().build(); + RewardedAd.load(activity, idReward, + adRequest, new RewardedAdLoadCallback() { + @Override + public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { + if (onLoadRewardsGoogle != null) { + onLoadRewardsGoogle.onAdFailedToLoad(); + } + mRewardedAd = null; + } - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { + @Override + public void onAdLoaded(@NonNull RewardedAd rewardedAd) { + if (onLoadRewardsGoogle != null) { + onLoadRewardsGoogle.onAdFailedToLoad(); + } + mRewardedAd = rewardedAd; - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); + } + }); switch (selectBackupAds) { case "FACEBOOK": rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); @@ -984,57 +729,6 @@ public void onRewardedVideoClosed() { .withAdListener(rewardedVideoAdListener2) .build()); break; - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - break; case "UNITY": IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { @Override @@ -1053,20 +747,6 @@ public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadErro e.printStackTrace(); } - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - - } - - @Override - public void failedToReceiveAd(int errorCode) { - - } - }); break; case "STARTAPP": rewardedVideo = new StartAppAd(activity); @@ -1089,30 +769,6 @@ public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { } }); break; - - case "ADMOB": - AdRequest adRequest = new AdRequest.Builder() - .build(); - RewardedAd.load(activity, idBackupReward, - adRequest, new RewardedAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - if (onLoadRewardsAdmob != null) { - onLoadRewardsAdmob.onAdFailedToLoad(); - } - mRewardedAd = null; - } - - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - if (onLoadRewardsAdmob != null) { - onLoadRewardsAdmob.onAdLoaded(""); - } - mRewardedAd = rewardedAd; - - } - }); - break; case "ALIEN-M": PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { @Override @@ -1133,1556 +789,174 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { } - public static void LoadRewardUnity(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { + public static void LoadRewardApplovinMax(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - } + } - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { + public static void LoadRewardApplovinDis(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - } - }; - try { - UnityAds.load(idReward, loadListener); - } catch (Exception e) { - e.printStackTrace(); - } + } - switch (selectBackupAds) { - case "ADMOB": - AdRequest adRequest = new AdRequest.Builder() - .build(); - RewardedAd.load(activity, idBackupReward, - adRequest, new RewardedAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - if (onLoadRewardsAdmob != null) { - onLoadRewardsAdmob.onAdFailedToLoad(); - } - mRewardedAd = null; - } - - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - if (onLoadRewardsAdmob != null) { - onLoadRewardsAdmob.onAdLoaded(""); - } - mRewardedAd = rewardedAd; - - } - }); - break; - case "FACEBOOK": - rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); - com.facebook.ads.RewardedVideoAdListener rewardedVideoAdListener2 = new com.facebook.ads.RewardedVideoAdListener() { - - @Override - public void onError(Ad ad, com.facebook.ads.AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - // Rewarded video ad is loaded and ready to be displayed - Log.d(TAG, "Rewarded video ad is loaded and ready to be displayed!"); - } - - @Override - public void onAdClicked(Ad ad) { - // Rewarded video ad clicked - Log.d(TAG, "Rewarded video ad clicked!"); - } - - @Override - public void onLoggingImpression(Ad ad) { - // Rewarded Video ad impression - the event will fire when the - // video starts playing - Log.d(TAG, "Rewarded video ad impression logged!"); - } - - @Override - public void onRewardedVideoCompleted() { - unlockreward = true; - } - - @Override - public void onRewardedVideoClosed() { - // The Rewarded Video ad was closed - this can occur during the video - // by closing the app, or closing the end card. - Log.d(TAG, "Rewarded video ad closed!"); - } - }; - rewardedVideoAdFan.loadAd( - rewardedVideoAdFan.buildLoadAdConfig() - .withAdListener(rewardedVideoAdListener2) - .build()); - break; - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - break; - case "UNITY": - IUnityAdsLoadListener loadListener2 = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idBackupReward, loadListener2); - } catch (Exception e) { - e.printStackTrace(); - } - - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - // A rewarded video was successfully received. - } - - @Override - public void failedToReceiveAd(int errorCode) { - // A rewarded video failed to load. - } - }); - break; - case "STARTAPP": - rewardedVideo = new StartAppAd(activity); - rewardedVideo.setVideoListener(new VideoListener() { - @Override - public void onVideoCompleted() { - unlockreward = true; - } - }); - - rewardedVideo.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() { - @Override - public void onReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - - @Override - public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - }); - break; - case "ALIEN-M": - PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - Log.i(TAG, "testing rewarded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - } - }); - break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - - } - } - - public static void LoadRewardGoogleAds(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - try { - AdManagerAdRequest adRequest = new AdManagerAdRequest.Builder().build(); - RewardedAd.load(activity, idReward, - adRequest, new RewardedAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - if (onLoadRewardsGoogle != null) { - onLoadRewardsGoogle.onAdFailedToLoad(); - } - mRewardedAd = null; - } - - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - if (onLoadRewardsGoogle != null) { - onLoadRewardsGoogle.onAdFailedToLoad(); - } - mRewardedAd = rewardedAd; - - } - }); - switch (selectBackupAds) { - case "FACEBOOK": - rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); - com.facebook.ads.RewardedVideoAdListener rewardedVideoAdListener2 = new com.facebook.ads.RewardedVideoAdListener() { - - @Override - public void onError(Ad ad, com.facebook.ads.AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - // Rewarded video ad is loaded and ready to be displayed - Log.d(TAG, "Rewarded video ad is loaded and ready to be displayed!"); - } - - @Override - public void onAdClicked(Ad ad) { - // Rewarded video ad clicked - Log.d(TAG, "Rewarded video ad clicked!"); - } - - @Override - public void onLoggingImpression(Ad ad) { - // Rewarded Video ad impression - the event will fire when the - // video starts playing - Log.d(TAG, "Rewarded video ad impression logged!"); - } - - @Override - public void onRewardedVideoCompleted() { - unlockreward = true; - } - - @Override - public void onRewardedVideoClosed() { - // The Rewarded Video ad was closed - this can occur during the video - // by closing the app, or closing the end card. - Log.d(TAG, "Rewarded video ad closed!"); - } - }; - rewardedVideoAdFan.loadAd( - rewardedVideoAdFan.buildLoadAdConfig() - .withAdListener(rewardedVideoAdListener2) - .build()); - break; - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - break; - case "UNITY": - IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idBackupReward, loadListener); - } catch (Exception e) { - e.printStackTrace(); - } - - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - // A rewarded video was successfully received. - } - - @Override - public void failedToReceiveAd(int errorCode) { - // A rewarded video failed to load. - } - }); - break; - case "STARTAPP": - rewardedVideo = new StartAppAd(activity); - rewardedVideo.setVideoListener(new VideoListener() { - @Override - public void onVideoCompleted() { - unlockreward = true; - } - }); - - rewardedVideo.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() { - @Override - public void onReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - - @Override - public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - }); - break; - case "ALIEN-M": - PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - Log.i(TAG, "testing rewarded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - } - }); - break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - - } - } catch (Exception e) { - e.printStackTrace(); - } - - } - - public static void LoadRewardApplovinMax(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - try { - rewardedAd = MaxRewardedAd.getInstance(idReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onRewardedVideoStarted(); - } - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onRewardedVideoCompleted(); - } - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onUserRewarded(); - } - } - - @Override - public void onAdLoaded(MaxAd ad) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onAdLoaded(); - } - } - - @Override - public void onAdDisplayed(MaxAd ad) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onAdDisplayed(); - } - } - - @Override - public void onAdHidden(MaxAd ad) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onAdHidden(); - } - } - - @Override - public void onAdClicked(MaxAd ad) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onAdClicked(); - } - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onAdLoadFailed(); - } - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - if (onLoadRewardsApplovinMax != null) { - onLoadRewardsApplovinMax.onAdDisplayFailed(); - } - } - }; - rewardedAd.setListener(maxRewardedAdListener); - switch (selectBackupAds) { - case "FACEBOOK": - rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); - com.facebook.ads.RewardedVideoAdListener rewardedVideoAdListener2 = new com.facebook.ads.RewardedVideoAdListener() { - - @Override - public void onError(Ad ad, com.facebook.ads.AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - // Rewarded video ad is loaded and ready to be displayed - Log.d(TAG, "Rewarded video ad is loaded and ready to be displayed!"); - } - - @Override - public void onAdClicked(Ad ad) { - // Rewarded video ad clicked - Log.d(TAG, "Rewarded video ad clicked!"); - } - - @Override - public void onLoggingImpression(Ad ad) { - // Rewarded Video ad impression - the event will fire when the - // video starts playing - Log.d(TAG, "Rewarded video ad impression logged!"); - } - - @Override - public void onRewardedVideoCompleted() { - unlockreward = true; - } - - @Override - public void onRewardedVideoClosed() { - // The Rewarded Video ad was closed - this can occur during the video - // by closing the app, or closing the end card. - Log.d(TAG, "Rewarded video ad closed!"); - } - }; - rewardedVideoAdFan.loadAd( - rewardedVideoAdFan.buildLoadAdConfig() - .withAdListener(rewardedVideoAdListener2) - .build()); - break; - case "ADMOB": - case "GOOGLE-ADS": - - AdRequest adRequest = new AdRequest.Builder() - - .build(); - RewardedAd.load(activity, idBackupReward, - adRequest, new RewardedAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - mRewardedAd = null; - } - - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - mRewardedAd = rewardedAd; - - } - }); - break; - case "UNITY": - IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idBackupReward, loadListener); - } catch (Exception e) { - e.printStackTrace(); - } - - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - // A rewarded video was successfully received. - } - - @Override - public void failedToReceiveAd(int errorCode) { - // A rewarded video failed to load. - } - }); - break; - case "STARTAPP": - rewardedVideo = new StartAppAd(activity); - rewardedVideo.setVideoListener(new VideoListener() { - @Override - public void onVideoCompleted() { - unlockreward = true; - } - }); - - rewardedVideo.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() { - @Override - public void onReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - - @Override - public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - }); - break; - case "ALIEN-M": - PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - Log.i(TAG, "testing rewarded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - } - }); - break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - - } - } catch (Exception e) { - e.printStackTrace(); - } - - } - - public static void LoadRewardApplovinDis(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - try { - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - if (onLoadRewardsApplovinDiscovery != null) { - onLoadRewardsApplovinDiscovery.adReceived(); - } - } - - @Override - public void failedToReceiveAd(int errorCode) { - if (onLoadRewardsApplovinDiscovery != null) { - onLoadRewardsApplovinDiscovery.failedToReceiveAd(""); - } - } - }); - switch (selectBackupAds) { - case "FACEBOOK": - rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); - com.facebook.ads.RewardedVideoAdListener rewardedVideoAdListener2 = new com.facebook.ads.RewardedVideoAdListener() { - - @Override - public void onError(Ad ad, com.facebook.ads.AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - // Rewarded video ad is loaded and ready to be displayed - Log.d(TAG, "Rewarded video ad is loaded and ready to be displayed!"); - } - - @Override - public void onAdClicked(Ad ad) { - // Rewarded video ad clicked - Log.d(TAG, "Rewarded video ad clicked!"); - } - - @Override - public void onLoggingImpression(Ad ad) { - // Rewarded Video ad impression - the event will fire when the - // video starts playing - Log.d(TAG, "Rewarded video ad impression logged!"); - } - - @Override - public void onRewardedVideoCompleted() { - unlockreward = true; - } - - @Override - public void onRewardedVideoClosed() { - // The Rewarded Video ad was closed - this can occur during the video - // by closing the app, or closing the end card. - Log.d(TAG, "Rewarded video ad closed!"); - } - }; - rewardedVideoAdFan.loadAd( - rewardedVideoAdFan.buildLoadAdConfig() - .withAdListener(rewardedVideoAdListener2) - .build()); - break; - case "ADMOB": - case "GOOGLE-ADS": - AdRequest adRequest = new AdRequest.Builder() - - .build(); - RewardedAd.load(activity, idBackupReward, - adRequest, new RewardedAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - mRewardedAd = null; - } - - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - mRewardedAd = rewardedAd; - - } - }); - break; - case "UNITY": - IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idBackupReward, loadListener); - } catch (Exception e) { - e.printStackTrace(); - } - - break; - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - - break; - case "STARTAPP": - rewardedVideo = new StartAppAd(activity); - rewardedVideo.setVideoListener(new VideoListener() { - @Override - public void onVideoCompleted() { - unlockreward = true; - } - }); - - rewardedVideo.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() { - @Override - public void onReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - - @Override - public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - - } - }); - break; - case "ALIEN-M": - PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - Log.i(TAG, "testing rewarded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - } - }); - break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - - } - } catch (Exception e) { - e.printStackTrace(); - } - - } - - public static void LoadRewardMopub(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - - } - - public static void LoadRewardIron(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { - } - - public static void LoadRewardStartApp(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - try { - rewardedVideo = new StartAppAd(activity); - rewardedVideo.setVideoListener(new VideoListener() { - @Override - public void onVideoCompleted() { - if (onLoadRewardsStartApp != null) { - onLoadRewardsStartApp.onVideoCompleted(); - } - unlockreward = true; - } - }); - - rewardedVideo.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() { - @Override - public void onReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - if (onLoadRewardsStartApp != null) { - onLoadRewardsStartApp.onReceiveAd(); - } - - } - - @Override - public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { - if (onLoadRewardsStartApp != null) { - onLoadRewardsStartApp.onFailedToReceiveAd(); - } - } - }); - switch (selectBackupAds) { - case "FACEBOOK": - rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); - com.facebook.ads.RewardedVideoAdListener rewardedVideoAdListener2 = new com.facebook.ads.RewardedVideoAdListener() { - - @Override - public void onError(Ad ad, com.facebook.ads.AdError adError) { - - } - - @Override - public void onAdLoaded(Ad ad) { - // Rewarded video ad is loaded and ready to be displayed - Log.d(TAG, "Rewarded video ad is loaded and ready to be displayed!"); - } - - @Override - public void onAdClicked(Ad ad) { - // Rewarded video ad clicked - Log.d(TAG, "Rewarded video ad clicked!"); - } - - @Override - public void onLoggingImpression(Ad ad) { - // Rewarded Video ad impression - the event will fire when the - // video starts playing - Log.d(TAG, "Rewarded video ad impression logged!"); - } - - @Override - public void onRewardedVideoCompleted() { - unlockreward = true; - } - - @Override - public void onRewardedVideoClosed() { - // The Rewarded Video ad was closed - this can occur during the video - // by closing the app, or closing the end card. - Log.d(TAG, "Rewarded video ad closed!"); - } - }; - rewardedVideoAdFan.loadAd( - rewardedVideoAdFan.buildLoadAdConfig() - .withAdListener(rewardedVideoAdListener2) - .build()); - break; - case "ADMOB": - case "GOOGLE-ADS": - AdRequest adRequest = new AdRequest.Builder() - - .build(); - RewardedAd.load(activity, idBackupReward, - adRequest, new RewardedAdLoadCallback() { - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - mRewardedAd = null; - } - - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - mRewardedAd = rewardedAd; - - } - }); - break; - case "APPLOVIN-D": - incentivizedInterstitial = AppLovinIncentivizedInterstitial.create(idBackupReward, AppLovinSdk.getInstance(activity)); - incentivizedInterstitial.preload(new AppLovinAdLoadListener() { - @Override - public void adReceived(AppLovinAd appLovinAd) { - // A rewarded video was successfully received. - } - - @Override - public void failedToReceiveAd(int errorCode) { - // A rewarded video failed to load. - } - }); - break; - case "APPLOVIN-M": - rewardedAd = MaxRewardedAd.getInstance(idBackupReward, activity); - rewardedAd.loadAd(); - MaxRewardedAdListener maxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - rewardedAd.setListener(maxRewardedAdListener); - - break; - - case "UNITY": - IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { - @Override - public void onUnityAdsAdLoaded(String placementId) { - - } - - @Override - public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { - - } - }; - try { - UnityAds.load(idBackupReward, loadListener); - } catch (Exception e) { - e.printStackTrace(); - } - - break; - case "ALIEN-M": - PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { - @Override - public void onAdLoaded(@NonNull RewardedAd rewardedAd) { - Log.i(TAG, "testing rewarded"); - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { - // Handle the error - } - }); - break; - case "ALIEN-V": - jamboxRewardedAd= MaxRewardedAd.getInstance(idBackupReward, activity); - jamboxRewardedAd.loadAd(); - MaxRewardedAdListener jamboxRewardedAdListener = new MaxRewardedAdListener() { - @Override - public void onRewardedVideoStarted(MaxAd ad) { - - } - - @Override - public void onRewardedVideoCompleted(MaxAd ad) { - unlockreward = true; - } - - @Override - public void onUserRewarded(MaxAd ad, MaxReward reward) { - - } - - @Override - public void onAdLoaded(MaxAd ad) { - - } - - @Override - public void onAdDisplayed(MaxAd ad) { - - } - - @Override - public void onAdHidden(MaxAd ad) { - - } - - @Override - public void onAdClicked(MaxAd ad) { - - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - - } - }; - jamboxRewardedAd.setListener(jamboxRewardedAdListener); - break; - } - } catch (Exception e) { - e.printStackTrace(); - } + public static void LoadRewardMopub(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { } - public static void LoadRewardWortise(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { - + public static void LoadRewardIron(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { } - public static void ShowRewardAdmob(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { + public static void LoadRewardStartApp(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { try { - if (mRewardedAd != null) { - Activity activityContext = activity; - mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - if (onShowRewardsAdmob != null) { - onShowRewardsAdmob.onUserEarnedReward(); - } - unlockreward = true; - LoadRewardAdmob(activity, selecBackuptAds, idReward, idBackupReward); + rewardedVideo = new StartAppAd(activity); + rewardedVideo.setVideoListener(new VideoListener() { + @Override + public void onVideoCompleted() { + if (onLoadRewardsStartApp != null) { + onLoadRewardsStartApp.onVideoCompleted(); } - }); - } else { - switch (selecBackuptAds) { - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; - case "UNITY": - IUnityAdsShowListener showListener = new IUnityAdsShowListener() { - @Override - public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { - LoadRewardUnity(activity, selecBackuptAds, idBackupReward, idBackupReward); - } - - @Override - public void onUnityAdsShowStart(String placementId) { - - } - - @Override - public void onUnityAdsShowClick(String placementId) { - - } - - @Override - public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { - unlockreward = true; - LoadRewardUnity(activity, selecBackuptAds, idReward, idBackupReward); - } - }; - UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); - break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); - } - }); - } - break; - case "STARTAPP": - if (rewardedVideo.isReady()) { - rewardedVideo.showAd(); - } - break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } - break; - case "ALIEN-M": - if (PropsAdsManagement.getRewardedAds() != null) { - PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); - } - break; - - case "ADMOB": - if (mRewardedAd2 != null) { - Activity activityContext = activity; - mRewardedAd2.show(activityContext, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); - } - break; - case "FACEBOOK": - if (rewardedVideoAdFan == null || !rewardedVideoAdFan.isAdLoaded()) { - - } else { - rewardedVideoAdFan.show(); - } - - break; + unlockreward = true; } + }); - } - } catch (Exception e) { - e.printStackTrace(); - } - LoadRewardAdmob(activity, selecBackuptAds, idReward, idBackupReward); - } - - public static void ShowRewardFan(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { - try { - if (rewardedVideoAdFan == null || !rewardedVideoAdFan.isAdLoaded()) { - switch (selecBackuptAds) { - case "FACEBOOK": - if (rewardedVideoAdFan2 == null || !rewardedVideoAdFan2.isAdLoaded()) { - - } else { - rewardedVideoAdFan2.show(); - } - break; - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; - case "UNITY": - IUnityAdsShowListener showListener = new IUnityAdsShowListener() { - @Override - public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { - LoadRewardUnity(activity, selecBackuptAds, idBackupReward, idBackupReward); - } - - @Override - public void onUnityAdsShowStart(String placementId) { - - } - - @Override - public void onUnityAdsShowClick(String placementId) { + rewardedVideo.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() { + @Override + public void onReceiveAd(com.startapp.sdk.adsbase.Ad ad) { + if (onLoadRewardsStartApp != null) { + onLoadRewardsStartApp.onReceiveAd(); + } - } + } - @Override - public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { - unlockreward = true; - LoadRewardUnity(activity, selecBackuptAds, idReward, idBackupReward); - } - }; - UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); - break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } + @Override + public void onFailedToReceiveAd(com.startapp.sdk.adsbase.Ad ad) { + if (onLoadRewardsStartApp != null) { + onLoadRewardsStartApp.onFailedToReceiveAd(); + } + } + }); + switch (selectBackupAds) { + case "FACEBOOK": + rewardedVideoAdFan = new RewardedVideoAd(activity, idBackupReward); + com.facebook.ads.RewardedVideoAdListener rewardedVideoAdListener2 = new com.facebook.ads.RewardedVideoAdListener() { - @Override - public void userOverQuota(AppLovinAd ad, Map response) { + @Override + public void onError(Ad ad, com.facebook.ads.AdError adError) { - } + } - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { + @Override + public void onAdLoaded(Ad ad) { + // Rewarded video ad is loaded and ready to be displayed + Log.d(TAG, "Rewarded video ad is loaded and ready to be displayed!"); + } - } + @Override + public void onAdClicked(Ad ad) { + // Rewarded video ad clicked + Log.d(TAG, "Rewarded video ad clicked!"); + } - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { + @Override + public void onLoggingImpression(Ad ad) { + // Rewarded Video ad impression - the event will fire when the + // video starts playing + Log.d(TAG, "Rewarded video ad impression logged!"); + } - } + @Override + public void onRewardedVideoCompleted() { + unlockreward = true; + } + @Override + public void onRewardedVideoClosed() { + // The Rewarded Video ad was closed - this can occur during the video + // by closing the app, or closing the end card. + Log.d(TAG, "Rewarded video ad closed!"); + } + }; + rewardedVideoAdFan.loadAd( + rewardedVideoAdFan.buildLoadAdConfig() + .withAdListener(rewardedVideoAdListener2) + .build()); + break; + case "ADMOB": + case "GOOGLE-ADS": + AdRequest adRequest = new AdRequest.Builder() - }, null, new AppLovinAdDisplayListener() { + .build(); + RewardedAd.load(activity, idBackupReward, + adRequest, new RewardedAdLoadCallback() { @Override - public void adDisplayed(AppLovinAd appLovinAd) { - + public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { + mRewardedAd = null; } @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); + public void onAdLoaded(@NonNull RewardedAd rewardedAd) { + mRewardedAd = rewardedAd; + } }); + break; + case "UNITY": + IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { + @Override + public void onUnityAdsAdLoaded(String placementId) { + } - break; - case "STARTAPP": - if (rewardedVideo.isReady()) { - rewardedVideo.showAd(); - } - break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); + + @Override + public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { + } - break; - case "ALIEN-M": - if (PropsAdsManagement.getRewardedAds() != null) { - PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); + }; + try { + UnityAds.load(idBackupReward, loadListener); + } catch (Exception e) { + e.printStackTrace(); + } + + break; + case "ALIEN-M": + PropsAdsManagement.loadRewardedAds(activity, idBackupReward, new RewardedAdLoadCallback() { + @Override + public void onAdLoaded(@NonNull RewardedAd rewardedAd) { + Log.i(TAG, "testing rewarded"); } - break; - case "ADMOB": - if (mRewardedAd != null) { - Activity activityContext = activity; - mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); + @Override + public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { + // Handle the error } - break; - } - } else { - rewardedVideoAdFan.show(); + }); + break; } - } catch (Exception e) { e.printStackTrace(); } - LoadRewardFan(activity, selecBackuptAds, idReward, idBackupReward); + } - public static void ShowRewardGoogleAds(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { + public static void LoadRewardWortise(Activity activity, String selectBackupAds, String idReward, String idBackupReward) { + + } + + public static void ShowRewardAdmob(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { try { if (mRewardedAd != null) { Activity activityContext = activity; mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { @Override public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - if (onShowRewardsGoogle != null) { - onShowRewardsGoogle.onUserEarnedReward(); + if (onShowRewardsAdmob != null) { + onShowRewardsAdmob.onUserEarnedReward(); } unlockreward = true; - LoadRewardGoogleAds(activity, selecBackuptAds, idReward, idBackupReward); + LoadRewardAdmob(activity, selecBackuptAds, idReward, idBackupReward); } }); } else { switch (selecBackuptAds) { - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -2708,53 +982,11 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp }; UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); - } - }); - } - break; case "STARTAPP": if (rewardedVideo.isReady()) { rewardedVideo.showAd(); } break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getRewardedAds() != null) { PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { @@ -2765,12 +997,25 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { }); } break; + + case "ADMOB": + if (mRewardedAd2 != null) { + Activity activityContext = activity; + mRewardedAd2.show(activityContext, new OnUserEarnedRewardListener() { + @Override + public void onUserEarnedReward(@NonNull RewardItem rewardItem) { + unlockreward = true; + } + }); + } + break; case "FACEBOOK": if (rewardedVideoAdFan == null || !rewardedVideoAdFan.isAdLoaded()) { } else { rewardedVideoAdFan.show(); } + break; } @@ -2778,33 +1023,18 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { } catch (Exception e) { e.printStackTrace(); } - LoadRewardGoogleAds(activity, selecBackuptAds, idReward, idBackupReward); + LoadRewardAdmob(activity, selecBackuptAds, idReward, idBackupReward); } - public static void ShowRewardApplovinMax(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { + public static void ShowRewardFan(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { try { - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - LoadRewardApplovinMax(activity, selecBackuptAds, idReward, idBackupReward); - } else { + if (rewardedVideoAdFan == null || !rewardedVideoAdFan.isAdLoaded()) { switch (selecBackuptAds) { case "FACEBOOK": - if (rewardedVideoAdFan == null || !rewardedVideoAdFan.isAdLoaded()) { + if (rewardedVideoAdFan2 == null || !rewardedVideoAdFan2.isAdLoaded()) { } else { - rewardedVideoAdFan.show(); - } - break; - case "GOOGLE-ADS": - case "ADMOB": - if (mRewardedAd != null) { - Activity activityContext = activity; - mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); + rewardedVideoAdFan2.show(); } break; case "UNITY": @@ -2832,53 +1062,11 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp }; UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); - } - }); - } - break; case "STARTAPP": if (rewardedVideo.isReady()) { rewardedVideo.showAd(); } break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getRewardedAds() != null) { PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { @@ -2889,82 +1077,45 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { }); } break; + + case "ADMOB": + if (mRewardedAd != null) { + Activity activityContext = activity; + mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { + @Override + public void onUserEarnedReward(@NonNull RewardItem rewardItem) { + unlockreward = true; + } + }); + } + break; } - + } else { + rewardedVideoAdFan.show(); } + } catch (Exception e) { e.printStackTrace(); } - LoadRewardApplovinMax(activity, selecBackuptAds, idReward, idBackupReward); + LoadRewardFan(activity, selecBackuptAds, idReward, idBackupReward); } - public static void ShowRewardApplovinDis(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { + public static void ShowRewardGoogleAds(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { try { - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { + if (mRewardedAd != null) { + Activity activityContext = activity; + mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - if (onShowRewardsApplovinDiscovery != null) { - onShowRewardsApplovinDiscovery.userRewardVerified(); + public void onUserEarnedReward(@NonNull RewardItem rewardItem) { + if (onShowRewardsGoogle != null) { + onShowRewardsGoogle.onUserEarnedReward(); } unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - if (onShowRewardsApplovinDiscovery != null) { - onShowRewardsApplovinDiscovery.userOverQuota(); - } - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - if (onShowRewardsApplovinDiscovery != null) { - onShowRewardsApplovinDiscovery.userRewardRejected(); - } - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - if (onShowRewardsApplovinDiscovery != null) { - onShowRewardsApplovinDiscovery.validationRequestFailed(); - } - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); + LoadRewardGoogleAds(activity, selecBackuptAds, idReward, idBackupReward); } }); - LoadRewardApplovinDis(activity, selecBackuptAds, idReward, idBackupReward); } else { switch (selecBackuptAds) { - case "FACEBOOK": - if (rewardedVideoAdFan == null || !rewardedVideoAdFan.isAdLoaded()) { - - } else { - rewardedVideoAdFan.show(); - } - break; - case "GOOGLE-ADS": - case "ADMOB": - if (mRewardedAd != null) { - Activity activityContext = activity; - mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -2990,21 +1141,11 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp }; UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); break; - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; case "STARTAPP": if (rewardedVideo.isReady()) { rewardedVideo.showAd(); } break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getRewardedAds() != null) { PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { @@ -3015,13 +1156,26 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { }); } break; + case "FACEBOOK": + if (rewardedVideoAdFan == null || !rewardedVideoAdFan.isAdLoaded()) { + + } else { + rewardedVideoAdFan.show(); + } + break; } } } catch (Exception e) { e.printStackTrace(); } - LoadRewardApplovinDis(activity, selecBackuptAds, idReward, idBackupReward); + LoadRewardGoogleAds(activity, selecBackuptAds, idReward, idBackupReward); + } + + public static void ShowRewardApplovinMax(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { + } + + public static void ShowRewardApplovinDis(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { } public static void ShowRewardMopub(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { @@ -3050,11 +1204,6 @@ public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError rewardedVideoAdFan2.show(); } break; - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -3080,53 +1229,11 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp }; UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); - } - }); - } - break; case "STARTAPP": if (rewardedVideo.isReady()) { rewardedVideo.showAd(); } break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getRewardedAds() != null) { PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { @@ -3185,11 +1292,6 @@ public static void ShowRewardStartApp(Activity activity, String selecBackuptAds, rewardedVideoAdFan.show(); } break; - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -3215,43 +1317,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp }; UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); - } - }); - } - break; case "GOOGLE-ADS": case "ADMOB": if (mRewardedAd != null) { @@ -3264,11 +1329,6 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { }); } break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } - break; case "ALIEN-M": if (PropsAdsManagement.getRewardedAds() != null) { PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { @@ -3289,118 +1349,6 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { } public static void ShowRewardAlienView(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { - try { - - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } else { - switch (selecBackuptAds) { - case "FACEBOOK": - if (rewardedVideoAdFan.isAdLoaded()) { - rewardedVideoAdFan.show(); - } - break; - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; - case "UNITY": - IUnityAdsShowListener showListener = new IUnityAdsShowListener() { - @Override - public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { - LoadRewardUnity(activity, selecBackuptAds, idBackupReward, idBackupReward); - } - - @Override - public void onUnityAdsShowStart(String placementId) { - - } - - @Override - public void onUnityAdsShowClick(String placementId) { - - } - - @Override - public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { - unlockreward = true; - LoadRewardUnity(activity, selecBackuptAds, idReward, idBackupReward); - } - }; - UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); - break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); - } - }); - } - break; - case "GOOGLE-ADS": - case "ADMOB": - if (mRewardedAd != null) { - Activity activityContext = activity; - mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); - } - break; - case "ALIEN-M": - if (PropsAdsManagement.getRewardedAds() != null) { - PropsAdsManagement.triggerRewardedAds(activity, new OnUserEarnedRewardListener() { - @Override - public void onUserEarnedReward(@NonNull RewardItem rewardItem) { - unlockreward = true; - } - }); - } - break; - case "STARTAPP": - if (rewardedVideo.isReady()) { - rewardedVideo.showAd(); - } - break; - } - } - - } catch (Exception e) { - e.printStackTrace(); - } - LoadRewardAlienView(activity, selecBackuptAds, idReward, idBackupReward); } public static void ShowRewardAlienMediation(Activity activity, String selecBackuptAds, String idReward, String idBackupReward) { @@ -3419,11 +1367,6 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { rewardedVideoAdFan.show(); } break; - case "APPLOVIN-M": - if (rewardedAd.isReady()) { - rewardedAd.showAd(); - } - break; case "UNITY": IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override @@ -3449,43 +1392,6 @@ public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowComp }; UnityAds.show(activity, idReward, new UnityAdsShowOptions(), showListener); break; - case "APPLOVIN-D": - if (incentivizedInterstitial != null) { - incentivizedInterstitial.show(activity, new AppLovinAdRewardListener() { - @Override - public void userRewardVerified(AppLovinAd ad, Map response) { - unlockreward = true; - } - - @Override - public void userOverQuota(AppLovinAd ad, Map response) { - - } - - @Override - public void userRewardRejected(AppLovinAd ad, Map response) { - - } - - @Override - public void validationRequestFailed(AppLovinAd ad, int errorCode) { - - } - - - }, null, new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(AppLovinAd appLovinAd) { - - } - - @Override - public void adHidden(AppLovinAd appLovinAd) { - incentivizedInterstitial.preload(null); - } - }); - } - break; case "GOOGLE-ADS": case "ADMOB": if (mRewardedAd != null) { @@ -3498,11 +1404,6 @@ public void onUserEarnedReward(@NonNull RewardItem rewardItem) { }); } break; - case "ALIEN-V": - if (jamboxRewardedAd.isReady()) { - jamboxRewardedAd.showAd(); - } - break; case "STARTAPP": if (rewardedVideo.isReady()) { rewardedVideo.showAd(); diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/ApplovinOpenAds.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/ApplovinOpenAds.java index 5793a3a..c732d1c 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/ApplovinOpenAds.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/ApplovinOpenAds.java @@ -13,11 +13,6 @@ import androidx.lifecycle.OnLifecycleEvent; import androidx.lifecycle.ProcessLifecycleOwner; -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxAdListener; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.ads.MaxAppOpenAd; - public class ApplovinOpenAds implements LifecycleObserver, Application.ActivityLifecycleCallbacks { public static MyApplication myApplication; public static Activity currentActivity; @@ -48,7 +43,6 @@ public static void LoadOpenAds(String idOpenAds, boolean loadads) { public static class AppOpenAdManager { private static final String LOG_TAG = "AppOpenAdManager"; - public static MaxAppOpenAd appOpenAdApplovin = null; private static boolean isLoadingAd = false; private static boolean isShowingAd = false; @@ -70,14 +64,11 @@ public static void loadAd(Context context) { } isLoadingAd = true; - appOpenAdApplovin = new MaxAppOpenAd(IDOPEN, context); - appOpenAdApplovin.loadAd(); - } public static boolean isAdAvailable() { - return appOpenAdApplovin != null; + return false; } @@ -105,59 +96,8 @@ public static void showAdIfAvailable(@NonNull final Activity activity, @NonNull return; } - Log.d(LOG_TAG, "Will show ad."); - appOpenAdApplovin.setListener(new MaxAdListener() { - @Override - public void onAdLoaded(MaxAd ad) { - isLoadingAd = true; - Log.d(LOG_TAG, "onAdLoaded."); - } - - @Override - public void onAdDisplayed(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdHidden(MaxAd ad) { - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - Log.d(LOG_TAG, "onAdDismissedFullScreenContent."); - } - - @Override - public void onAdClicked(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - }); - - isShowingAd = true; - appOpenAdApplovin.showAd(); + isLoadingAd = false; + onShowAdCompleteListener.onShowAdComplete(); } diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/JamboxOpenAds.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/JamboxOpenAds.java index 18b7a75..cebd8c1 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/JamboxOpenAds.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/JamboxOpenAds.java @@ -13,10 +13,6 @@ import androidx.lifecycle.OnLifecycleEvent; import androidx.lifecycle.ProcessLifecycleOwner; -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxAdListener; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.ads.MaxAppOpenAd; import com.google.android.gms.ads.AdError; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.FullScreenContentCallback; @@ -115,7 +111,6 @@ public interface OnShowAdCompleteListener { public static class AppOpenAdManager { private static final String LOG_TAG = "AppOpenAdManager"; public static AppOpenAd appOpenAd = null; - public static MaxAppOpenAd appOpenAdApplovin = null; private static boolean isLoadingAd = false; static boolean isShowingAd = false; private static long loadTime = 0; @@ -156,8 +151,6 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { } isLoadingAd = true; - appOpenAdApplovin = new MaxAppOpenAd(IDOPEN, context); - appOpenAdApplovin.loadAd(); } else { if (isLoadingAd || isAdAvailable()) { @@ -195,14 +188,7 @@ private static boolean wasLoadTimeLessThanNHoursAgo(long numHours) { } private static boolean isAdAvailable() { - if (SELECT_ADS.equals("ADMOB")) { - return appOpenAd != null && wasLoadTimeLessThanNHoursAgo(4); - } else if (SELECT_ADS.equals("ALIEN-V")) { - return appOpenAdApplovin != null; - } else { return appOpenAd != null && wasLoadTimeLessThanNHoursAgo(4); - } - } public static void showAdIfAvailable(@NonNull final Activity activity) { @@ -264,60 +250,10 @@ public void onAdShowedFullScreenContent() { loadAd(activity); return; } + isLoadingAd = false; + isShowingAd = false; + onShowAdCompleteListener.onShowAdComplete(); - Log.d(LOG_TAG, "Will show ad."); - appOpenAdApplovin.setListener(new MaxAdListener() { - @Override - public void onAdLoaded(MaxAd ad) { - isLoadingAd = true; - Log.d(LOG_TAG, "onAdLoaded."); - } - - @Override - public void onAdDisplayed(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdHidden(MaxAd ad) { - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - Log.d(LOG_TAG, "onAdDismissedFullScreenContent."); - } - - @Override - public void onAdClicked(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - }); - - isShowingAd = true; - appOpenAdApplovin.showAd(); } else { if (isShowingAd) { return; diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/MyApplication.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/MyApplication.java index 65431ac..7250754 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/MyApplication.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/MyApplication.java @@ -19,8 +19,6 @@ public class MyApplication extends Application { @SuppressLint("StaticFieldLeak") private static AlienOpenAds alienOpenAds; @SuppressLint("StaticFieldLeak") - private static JamboxOpenAds jsmboxOpenAds; - @SuppressLint("StaticFieldLeak") private static PropsOpenAds propsOpenAds; @SuppressLint("StaticFieldLeak") private static ApplovinOpenAds applovinOpenAds; @@ -35,7 +33,6 @@ public void onCreate() { if (isMainProcess()) { alienOpenAds = new AlienOpenAds(this); propsOpenAds = new PropsOpenAds(this); - jsmboxOpenAds = new JamboxOpenAds(this); notif = new AlienNotif(context,this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { String processName = getProcessName(); diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/PropsOpenAds.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/PropsOpenAds.java index 0906b29..da1059d 100644 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/PropsOpenAds.java +++ b/AlienAdsV2/src/main/java/com/aliendroid/alienads/PropsOpenAds.java @@ -12,11 +12,6 @@ import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.OnLifecycleEvent; import androidx.lifecycle.ProcessLifecycleOwner; - -import com.applovin.mediation.MaxAd; -import com.applovin.mediation.MaxAdListener; -import com.applovin.mediation.MaxError; -import com.applovin.mediation.ads.MaxAppOpenAd; import com.google.android.gms.ads.AdError; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.FullScreenContentCallback; @@ -116,7 +111,6 @@ public interface OnShowAdCompleteListener { public static class AppOpenAdManager { private static final String LOG_TAG = "AppOpenAdManager"; public static AppOpenAd appOpenAd = null; - public static MaxAppOpenAd appOpenAdApplovin = null; private static boolean isLoadingAd = false; static boolean isShowingAd = false; private static long loadTime = 0; @@ -155,11 +149,7 @@ public void onAdFailedToLoad(LoadAdError loadAdError) { if (isLoadingAd || isAdAvailable()) { return; } - isLoadingAd = true; - appOpenAdApplovin = new MaxAppOpenAd(IDOPEN, context); - appOpenAdApplovin.loadAd(); - } else { if (isLoadingAd || isAdAvailable()) { return; @@ -196,14 +186,7 @@ private static boolean wasLoadTimeLessThanNHoursAgo(long numHours) { } private static boolean isAdAvailable() { - if (SELECT_ADS.equals("ALIEN-M")) { - return appOpenAd != null && wasLoadTimeLessThanNHoursAgo(4); - } else if (SELECT_ADS.equals("APPLOVIN-M")) { - return appOpenAdApplovin != null; - } else { return appOpenAd != null && wasLoadTimeLessThanNHoursAgo(4); - } - } public static void showAdIfAvailable(@NonNull final Activity activity) { showAdIfAvailable(activity, new OnShowAdCompleteListener() { @@ -263,60 +246,9 @@ public void onAdShowedFullScreenContent() { loadAd(activity); return; } - - Log.d(LOG_TAG, "Will show ad."); - appOpenAdApplovin.setListener(new MaxAdListener() { - @Override - public void onAdLoaded(MaxAd ad) { - isLoadingAd = true; - Log.d(LOG_TAG, "onAdLoaded."); - } - - @Override - public void onAdDisplayed(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdHidden(MaxAd ad) { - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - Log.d(LOG_TAG, "onAdDismissedFullScreenContent."); - } - - @Override - public void onAdClicked(MaxAd ad) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - loadAd(activity); - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - isLoadingAd = false; - appOpenAdApplovin = null; - isShowingAd = false; - onShowAdCompleteListener.onShowAdComplete(); - loadAd(activity); - } - }); - - isShowingAd = true; - appOpenAdApplovin.showAd(); + isLoadingAd = false; + isShowingAd = false; + loadAd(activity); } else { if (isShowingAd) { return; diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventBanner.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventBanner.java deleted file mode 100644 index db28f33..0000000 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventBanner.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.aliendroid.alienads.config; - -import static android.util.Log.DEBUG; -import static android.util.Log.ERROR; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.util.Log; - -import com.applovin.adview.AppLovinAdView; -import com.applovin.sdk.AppLovinAd; -import com.applovin.sdk.AppLovinAdClickListener; -import com.applovin.sdk.AppLovinAdDisplayListener; -import com.applovin.sdk.AppLovinAdLoadListener; -import com.applovin.sdk.AppLovinAdSize; -import com.applovin.sdk.AppLovinErrorCodes; -import com.applovin.sdk.AppLovinSdk; -import com.google.android.gms.ads.AdRequest; -import com.google.android.gms.ads.AdSize; -import com.google.android.gms.ads.mediation.MediationAdRequest; -import com.google.android.gms.ads.mediation.customevent.CustomEventBanner; -import com.google.android.gms.ads.mediation.customevent.CustomEventBannerListener; - -/** - * AppLovin SDK banner adapter for AdMob. - *

- * Created by thomasso on 4/12/17. - */ -//Uranus -public class AppLovinCustomEventBanner - implements CustomEventBanner { - private static final boolean LOGGING_ENABLED = true; - private static final String DEFAULT_ZONE = ""; - - private static final int BANNER_STANDARD_HEIGHT = 50; - private static final int BANNER_HEIGHT_OFFSET_TOLERANCE = 10; - - private AppLovinAdView adView; - - // - // AdMob Custom Event Methods - // - - private static void log(final int priority, final String message) { - if (LOGGING_ENABLED) { - Log.println(priority, "AppLovinBanner", message); - } - } - - private static int toAdMobErrorCode(final int applovinErrorCode) { - if (applovinErrorCode == AppLovinErrorCodes.NO_FILL) { - return AdRequest.ERROR_CODE_NO_FILL; - } else if (applovinErrorCode == AppLovinErrorCodes.NO_NETWORK || applovinErrorCode == AppLovinErrorCodes.FETCH_AD_TIMEOUT) { - return AdRequest.ERROR_CODE_NETWORK_ERROR; - } else { - return AdRequest.ERROR_CODE_INTERNAL_ERROR; - } - } - - @Override - public void requestBannerAd(final Context context, final CustomEventBannerListener customEventBannerListener, final String serverParameter, final AdSize adSize, final MediationAdRequest mediationAdRequest, final Bundle customEventExtras) { - // SDK versions BELOW 7.1.0 require a instance of an Activity to be passed in as the context - if (AppLovinSdk.VERSION_CODE < 710 && !(context instanceof Activity)) { - log(ERROR, "Unable to request AppLovin banner. Invalid context provided."); - customEventBannerListener.onAdFailedToLoad(AdRequest.ERROR_CODE_INTERNAL_ERROR); - - return; - } - - log(DEBUG, "Requesting AppLovin banner of size: " + adSize); - - final AppLovinAdSize appLovinAdSize = appLovinAdSizeFromAdMobAdSize(adSize); - if (appLovinAdSize != null) { - final AppLovinSdk sdk = AppLovinSdk.getInstance(context); - sdk.setPluginVersion("AdMob-2.2.1"); - - // Zones support is available on AppLovin SDK 7.5.0 and higher - final String zoneId; - if (AppLovinSdk.VERSION_CODE >= 750 && customEventExtras != null && customEventExtras.containsKey("zone_id")) { - zoneId = customEventExtras.getString("zone_id"); - } else { - zoneId = DEFAULT_ZONE; - } - - adView = new AppLovinAdView(appLovinAdSize, zoneId, context); - adView.setAdLoadListener(new AppLovinAdLoadListener() { - @Override - public void adReceived(final AppLovinAd ad) { - log(DEBUG, "Successfully loaded banner ad"); - customEventBannerListener.onAdLoaded(adView); - } - - @Override - public void failedToReceiveAd(final int errorCode) { - log(ERROR, "Failed to load banner ad with code: " + errorCode); - customEventBannerListener.onAdFailedToLoad(toAdMobErrorCode(errorCode)); - } - }); - adView.setAdDisplayListener(new AppLovinAdDisplayListener() { - @Override - public void adDisplayed(final AppLovinAd ad) { - log(DEBUG, "Banner displayed"); - } - - @Override - public void adHidden(final AppLovinAd ad) { - log(DEBUG, "Banner dismissed"); - } - }); - adView.setAdClickListener(new AppLovinAdClickListener() { - @Override - public void adClicked(final AppLovinAd ad) { - log(DEBUG, "Banner clicked"); - - customEventBannerListener.onAdOpened(); - customEventBannerListener.onAdLeftApplication(); - } - }); - - adView.loadNextAd(); - } else { - log(ERROR, "Unable to request AppLovin banner"); - customEventBannerListener.onAdFailedToLoad(AdRequest.ERROR_CODE_INTERNAL_ERROR); - } - } - - @Override - public void onDestroy() { - if (adView != null) adView.destroy(); - } - - // - // Utility Methods - // - - @Override - public void onPause() { - if (adView != null) adView.pause(); - } - - @Override - public void onResume() { - if (adView != null) adView.resume(); - } - - private AppLovinAdSize appLovinAdSizeFromAdMobAdSize(final AdSize adSize) { - final boolean isSmartBanner = (adSize.getWidth() == AdSize.FULL_WIDTH) && (adSize.getHeight() == AdSize.AUTO_HEIGHT); - - if (AdSize.BANNER.equals(adSize) || AdSize.LARGE_BANNER.equals(adSize) || isSmartBanner) { - return AppLovinAdSize.BANNER; - } else if (AdSize.MEDIUM_RECTANGLE.equals(adSize)) { - return AppLovinAdSize.MREC; - } else if (AdSize.LEADERBOARD.equals(adSize)) { - return AppLovinAdSize.LEADER; - } - // This is not a one of AdMob's predefined size - else { - // Assume fluid width, and check for height with offset tolerance - final int offset = Math.abs(BANNER_STANDARD_HEIGHT - adSize.getHeight()); - if (offset <= BANNER_HEIGHT_OFFSET_TOLERANCE) { - return AppLovinAdSize.BANNER; - } - } - - return null; - } -} \ No newline at end of file diff --git a/AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventInterstitial.java b/AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventInterstitial.java deleted file mode 100644 index 0b05924..0000000 --- a/AlienAdsV2/src/main/java/com/aliendroid/alienads/config/AppLovinCustomEventInterstitial.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.aliendroid.alienads.config; - -import static android.util.Log.DEBUG; -import static android.util.Log.ERROR; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.os.Handler; -import android.os.Looper; -import android.util.Log; - -import com.applovin.adview.AppLovinInterstitialAd; -import com.applovin.adview.AppLovinInterstitialAdDialog; -import com.applovin.sdk.AppLovinAd; -import com.applovin.sdk.AppLovinAdClickListener; -import com.applovin.sdk.AppLovinAdDisplayListener; -import com.applovin.sdk.AppLovinAdLoadListener; -import com.applovin.sdk.AppLovinAdSize; -import com.applovin.sdk.AppLovinAdVideoPlaybackListener; -import com.applovin.sdk.AppLovinErrorCodes; -import com.applovin.sdk.AppLovinSdk; -import com.google.android.gms.ads.AdRequest; -import com.google.android.gms.ads.mediation.MediationAdRequest; -import com.google.android.gms.ads.mediation.customevent.CustomEventInterstitial; -import com.google.android.gms.ads.mediation.customevent.CustomEventInterstitialListener; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; -import java.util.Queue; -//Uranus - -/** - * AppLovin SDK interstitial adapter for AdMob. - *

- * Created by Thomas So on 5/28/17. - */ - -// -// PLEASE NOTE: We have renamed this class from "YOUR_PACKAGE_NAME.AdMobMediationInterEvent" to "YOUR_PACKAGE_NAME.AppLovinCustomEventInterstitial", you can use either classname in your AdMob account. -// -public class AppLovinCustomEventInterstitial - implements CustomEventInterstitial, AppLovinAdLoadListener, AppLovinAdDisplayListener, AppLovinAdClickListener, AppLovinAdVideoPlaybackListener { - private static final boolean LOGGING_ENABLED = true; - private static final Handler UI_HANDLER = new Handler(Looper.getMainLooper()); - private static final String DEFAULT_ZONE = ""; - - // A map of Zone -> Queue of `AppLovinAd`s to be shared by instances of the custom event. - // This prevents skipping of ads as this adapter will be re-created and preloaded - // on every ad load regardless if ad was actually displayed or not. - private static final Map> GLOBAL_INTERSTITIAL_ADS = new HashMap>(); - private static final Object GLOBAL_INTERSTITIAL_ADS_LOCK = new Object(); - - private Context context; - private CustomEventInterstitialListener listener; - - private String zoneId; // The zone identifier this instance of the custom event is loading for - - // - // AdMob Custom Event Methods - // - - private static AppLovinAd dequeueAd(final String zoneId) { - synchronized (GLOBAL_INTERSTITIAL_ADS_LOCK) { - AppLovinAd preloadedAd = null; - - final Queue preloadedAds = GLOBAL_INTERSTITIAL_ADS.get(zoneId); - if (preloadedAds != null && !preloadedAds.isEmpty()) { - preloadedAd = preloadedAds.poll(); - } - - return preloadedAd; - } - } - - private static void enqueueAd(final AppLovinAd ad, final String zoneId) { - synchronized (GLOBAL_INTERSTITIAL_ADS_LOCK) { - Queue preloadedAds = GLOBAL_INTERSTITIAL_ADS.get(zoneId); - if (preloadedAds == null) { - preloadedAds = new LinkedList(); - GLOBAL_INTERSTITIAL_ADS.put(zoneId, preloadedAds); - } - - preloadedAds.offer(ad); - } - } - - private static void log(final int priority, final String message) { - if (LOGGING_ENABLED) { - Log.println(priority, "AppLovinInterstitial", message); - } - } - - private static int toAdMobErrorCode(final int applovinErrorCode) { - if (applovinErrorCode == AppLovinErrorCodes.NO_FILL) { - return AdRequest.ERROR_CODE_NO_FILL; - } else if (applovinErrorCode == AppLovinErrorCodes.NO_NETWORK || applovinErrorCode == AppLovinErrorCodes.FETCH_AD_TIMEOUT) { - return AdRequest.ERROR_CODE_NETWORK_ERROR; - } else { - return AdRequest.ERROR_CODE_INTERNAL_ERROR; - } - } - - /** - * Performs the given runnable on the main thread. - */ - public static void runOnUiThread(final Runnable runnable) { - if (Looper.myLooper() == Looper.getMainLooper()) { - runnable.run(); - } else { - UI_HANDLER.post(runnable); - } - } - - // - // Ad Load Listener - // - - @Override - public void requestInterstitialAd(final Context context, final CustomEventInterstitialListener listener, final String serverParameter, final MediationAdRequest mediationAdRequest, final Bundle customEventExtras) { - log(DEBUG, "Requesting AppLovin interstitial..."); - - // SDK versions BELOW 7.2.0 require a instance of an Activity to be passed in as the context - if (AppLovinSdk.VERSION_CODE < 720 && !(context instanceof Activity)) { - log(ERROR, "Unable to request AppLovin interstitial. Invalid context provided."); - listener.onAdFailedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST); - - return; - } - - // Store parent objects - this.listener = listener; - this.context = context; - - final AppLovinSdk sdk = AppLovinSdk.getInstance(context); - sdk.setPluginVersion("AdMob-2.2.1"); - - // Zones support is available on AppLovin SDK 7.5.0 and higher - if (AppLovinSdk.VERSION_CODE >= 750 && customEventExtras != null && customEventExtras.containsKey("zone_id")) { - zoneId = customEventExtras.getString("zone_id"); - } else { - zoneId = DEFAULT_ZONE; - } - - // Check if we already have a preloaded ad for the given zone - final AppLovinAd preloadedAd = dequeueAd(zoneId); - if (preloadedAd != null) { - log(DEBUG, "Found preloaded ad for zone: {" + zoneId + "}"); - adReceived(preloadedAd); - } else { - // If this is a default Zone, load the interstitial ad normally - if (DEFAULT_ZONE.equals(zoneId)) { - sdk.getAdService().loadNextAd(AppLovinAdSize.INTERSTITIAL, this); - } - // Otherwise, use the Zones API - else { - sdk.getAdService().loadNextAdForZoneId(zoneId, this); - } - } - } - - @Override - public void showInterstitial() { - final AppLovinAd preloadedAd = dequeueAd(zoneId); - if (preloadedAd != null) { - final AppLovinSdk sdk = AppLovinSdk.getInstance(context); - - final AppLovinInterstitialAdDialog interstitialAd = AppLovinInterstitialAd.create(sdk, context); - interstitialAd.setAdDisplayListener(this); - interstitialAd.setAdClickListener(this); - interstitialAd.setAdVideoPlaybackListener(this); - interstitialAd.showAndRender(preloadedAd); - } else { - log(ERROR, "Failed to show an AppLovin interstitial before one was loaded"); - listener.onAdFailedToLoad(AdRequest.ERROR_CODE_INTERNAL_ERROR); - } - } - - // - // Ad Display Listener - // - - @Override - public void onPause() { - } - - @Override - public void onResume() { - } - - // - // Ad Click Listener - // - - @Override - public void onDestroy() { - } - - // - // Video Playback Listener - // - - @Override - public void adReceived(final AppLovinAd ad) { - log(DEBUG, "Interstitial did load ad: " + ad.getAdIdNumber()); - - enqueueAd(ad, zoneId); - - runOnUiThread(new Runnable() { - @Override - public void run() { - listener.onAdLoaded(); - } - }); - } - - @Override - public void failedToReceiveAd(final int errorCode) { - log(ERROR, "Interstitial failed to load with error: " + errorCode); - - runOnUiThread(new Runnable() { - @Override - public void run() { - listener.onAdFailedToLoad(toAdMobErrorCode(errorCode)); - } - }); - } - - // - // Utility Methods - // - - @Override - public void adDisplayed(final AppLovinAd appLovinAd) { - log(DEBUG, "Interstitial displayed"); - listener.onAdOpened(); - } - - @Override - public void adHidden(final AppLovinAd appLovinAd) { - log(DEBUG, "Interstitial dismissed"); - listener.onAdClosed(); - } - - @Override - public void adClicked(final AppLovinAd appLovinAd) { - log(DEBUG, "Interstitial clicked"); - listener.onAdLeftApplication(); - } - - @Override - public void videoPlaybackBegan(final AppLovinAd ad) { - log(DEBUG, "Interstitial video playback began"); - } - - @Override - public void videoPlaybackEnded(final AppLovinAd ad, final double percentViewed, final boolean fullyWatched) { - log(DEBUG, "Interstitial video playback ended at playback percent: " + percentViewed); - } -} \ No newline at end of file diff --git a/local.properties b/local.properties index c2c1f6b..d49e9ff 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Mon Apr 29 12:31:01 WIB 2024 -sdk.dir=/home/reskin-aliendroid/Android/Sdk +#Mon Dec 16 10:26:23 WIB 2024 +sdk.dir=/home/bekah-jaya/Android/Sdk