Skip to content

Commit

Permalink
Admob 23.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rysasahrial-99 committed Dec 19, 2024
1 parent 4dd49bf commit 43c4209
Show file tree
Hide file tree
Showing 17 changed files with 1,552 additions and 14,185 deletions.
32 changes: 10 additions & 22 deletions AlienAdsV2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

}
66 changes: 0 additions & 66 deletions AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienGDPR.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;

}
}

Expand All @@ -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]);
Expand All @@ -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 "";
}
Expand Down
28 changes: 0 additions & 28 deletions AlienAdsV2/src/main/java/com/aliendroid/alienads/AlienNotif.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
}
}));
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 43c4209

Please sign in to comment.