Commit fdf059cd authored by wanglei's avatar wanglei

...移除max

parent 02ba2215
......@@ -92,13 +92,13 @@ dependencies {
//广告
implementation("com.google.android.gms:play-services-ads:23.1.0")
implementation 'com.google.ads.mediation:applovin:12.4.3.0'
// implementation 'com.google.ads.mediation:applovin:12.4.3.0'
implementation 'com.google.ads.mediation:facebook:6.17.0.0'
implementation 'com.google.ads.mediation:mintegral:16.7.21.0'
implementation 'com.google.ads.mediation:pangle:5.9.0.4.0'
//max
implementation 'com.applovin:applovin-sdk:+'
// implementation 'com.applovin:applovin-sdk:+'
// implementation 'com.applovin.mediation:google-adapter:+'
// implementation 'com.applovin.mediation:facebook-adapter:+'
// implementation 'com.applovin.mediation:mintegral-adapter:+'
......
......@@ -3,15 +3,9 @@ package com.base.filerecoveryrecyclebin.ads
import android.app.Activity
import android.util.Log
import android.view.ViewGroup
import com.base.filerecoveryrecyclebin.R
import com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils
import com.base.filerecoveryrecyclebin.ads.admob.AdmobNativeUtils
import com.base.filerecoveryrecyclebin.ads.admob.AdmobOpenUtils
import com.base.filerecoveryrecyclebin.ads.max.AdMaxInit
import com.base.filerecoveryrecyclebin.ads.max.AdMaxInit.initAdMax
import com.base.filerecoveryrecyclebin.ads.max.AdMaxInterstitialUtils
import com.base.filerecoveryrecyclebin.ads.max.AdMaxNativeUtils
import com.base.filerecoveryrecyclebin.ads.max.AdMaxOpenUtils
import com.base.filerecoveryrecyclebin.help.BaseApplication
import com.base.filerecoveryrecyclebin.utils.AppPreferences
import com.base.filerecoveryrecyclebin.utils.EventUtils
......@@ -51,7 +45,7 @@ object AdmobMaxHelper {
if (isBlack) {
return
}
if (getSpAdmobTrueMaxFalse()) {
if (true) {
if (!isAdInit.get()) {
LogEx.logDebug(TAG, "init sp Admob")
MobileAds.initialize(BaseApplication.context) { initializationStatus ->
......@@ -59,20 +53,21 @@ object AdmobMaxHelper {
}
}
} else {
if (!isAdInit.get()) {
LogEx.logDebug(TAG, "init sp AdMax")
BaseApplication.context.initAdMax()
}
// if (!isAdInit.get()) {
// LogEx.logDebug(TAG, "init sp AdMax")
// BaseApplication.context.initAdMax()
// }
}
}
//End end
fun isOpenAdLoaded(): Boolean {
return if (getSpAdmobTrueMaxFalse()) {
AdmobOpenUtils.isOpenAdLoaded()
} else {
AdMaxOpenUtils.isOpenAdLoaded()
}
// if (getSpAdmobTrueMaxFalse()) {
//
// } else {
// AdMaxOpenUtils.isOpenAdLoaded()
// }
return AdmobOpenUtils.isOpenAdLoaded()
}
//展示广告关闭时赋值
......@@ -96,14 +91,14 @@ object AdmobMaxHelper {
return
}
if (getSpAdmobTrueMaxFalse()) {
if (true) {
AdmobInterstitialUtils.showInterstitialAd(activity) {
onHidden?.invoke()
}
} else {
AdMaxInterstitialUtils.showInterstitialAd(activity) {
onHidden?.invoke()
}
// AdMaxInterstitialUtils.showInterstitialAd(activity) {
// onHidden?.invoke()
// }
}
}
......@@ -116,14 +111,14 @@ object AdmobMaxHelper {
onHidden?.invoke()
return
}
if (getSpAdmobTrueMaxFalse()) {
if (true) {
AdmobOpenUtils.showAppOpenAd(activity, showBefore = showBeforeAction) {
onHidden?.invoke()
}
} else {
AdMaxOpenUtils.showAppOpenAd(activity, loadCallBack = showBeforeAction) {
onHidden?.invoke()
}
// AdMaxOpenUtils.showAppOpenAd(activity, loadCallBack = showBeforeAction) {
// onHidden?.invoke()
// }
}
}
......@@ -131,20 +126,20 @@ object AdmobMaxHelper {
if (isBlack) {
return
}
if (getSpAdmobTrueMaxFalse()) {
if (true) {
AdmobNativeUtils.showNativeAd(activity, parent)
} else {
var layout = R.layout.layout_max_native_small
if (where == 0) {
layout = R.layout.layout_max_native_small_f8f8f8
}
if (where == 1) {
layout = R.layout.layout_max_native_big
}
if (where == 2) {
layout = R.layout.layout_max_native_big_2
}
AdMaxNativeUtils.showNativeAd(activity, parent, layout)
// var layout = R.layout.layout_max_native_small
// if (where == 0) {
// layout = R.layout.layout_max_native_small_f8f8f8
// }
// if (where == 1) {
// layout = R.layout.layout_max_native_big
// }
// if (where == 2) {
// layout = R.layout.layout_max_native_big_2
// }
// AdMaxNativeUtils.showNativeAd(activity, parent, layout)
}
}
......@@ -153,19 +148,19 @@ object AdmobMaxHelper {
return
}
if (getSpAdmobTrueMaxFalse()) {
if (true) {
// AdmobOpenUtils.loadAppOpenAd()
AdmobInterstitialUtils.loadInterstitialAd(activity)
} else {
if (isAdInit.get()) {
// AdMaxOpenUtils.loadAppOpenAd(activity)
AdMaxInterstitialUtils.loadInterstitialAd(activity)
// AdMaxInterstitialUtils.loadInterstitialAd(activity)
} else {
AdMaxInit.maxInitAction = {
Log.d(TAG, "max init suc")
// AdMaxInit.maxInitAction = {
Log.d(TAG, "max init suc")
// AdMaxOpenUtils.loadAppOpenAd(activity)
// AdMaxInterstitialUtils.loadInterstitialAd(activity)
}
// }
}
}
}
......
package com.base.filerecoveryrecyclebin.ads.max
import android.content.Context
import com.applovin.sdk.AppLovinMediationProvider
import com.applovin.sdk.AppLovinSdk
import com.applovin.sdk.AppLovinSdkInitializationConfiguration
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper.isAdInit
import com.base.filerecoveryrecyclebin.utils.EventUtils
import com.base.filerecoveryrecyclebin.utils.LogEx
import java.util.concurrent.Executors
object AdMaxInit {
private val TAG = "AdMaxInit"
var maxInitAction: (() -> Unit)? = null
fun Context.initAdMax() {
// If you want to test your own AppLovin SDK key, change the value here and update the package name in the build.gradle
// val YOUR_SDK_KEY = "05TMDQ5tZabpXQ45_UTbmEGNUtVAzSTzT6KmWQc5_CuWdzccS4DCITZoL3yIWUG3bbq60QC_d4WF28tUC4gVTF"
val YOUR_SDK_KEY = "GGPreND6SRmCt1zJgn5faiLGD8c2PVGPLgPpSg7cHanVTud1DhtuI9MmteTqlEviaJ57WnxW68kQDaATJ5z3cW"
val executor = Executors.newSingleThreadExecutor();
executor.execute {
val initConfigBuilder = AppLovinSdkInitializationConfiguration.builder(YOUR_SDK_KEY, this)
initConfigBuilder.mediationProvider = AppLovinMediationProvider.MAX
// Enable test mode by default for the current device. Cannot be run on the main thread.
// val currentGaid = AdvertisingIdClient.getAdvertisingIdInfo(this).id
// if (currentGaid != null) {
// initConfigBuilder.testDeviceAdvertisingIds = Collections.singletonList(currentGaid)
//package com.base.filerecoveryrecyclebin.ads.max
//
//import android.content.Context
//import com.applovin.sdk.AppLovinMediationProvider
//import com.applovin.sdk.AppLovinSdk
//import com.applovin.sdk.AppLovinSdkInitializationConfiguration
//import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper.isAdInit
//import com.base.filerecoveryrecyclebin.utils.EventUtils
//import com.base.filerecoveryrecyclebin.utils.LogEx
//import java.util.concurrent.Executors
//
//object AdMaxInit {
//
// private val TAG = "AdMaxInit"
// var maxInitAction: (() -> Unit)? = null
//
// fun Context.initAdMax() {
// // If you want to test your own AppLovin SDK key, change the value here and update the package name in the build.gradle
//// val YOUR_SDK_KEY = "05TMDQ5tZabpXQ45_UTbmEGNUtVAzSTzT6KmWQc5_CuWdzccS4DCITZoL3yIWUG3bbq60QC_d4WF28tUC4gVTF"
// val YOUR_SDK_KEY = "GGPreND6SRmCt1zJgn5faiLGD8c2PVGPLgPpSg7cHanVTud1DhtuI9MmteTqlEviaJ57WnxW68kQDaATJ5z3cW"
//
// val executor = Executors.newSingleThreadExecutor();
// executor.execute {
//
// val initConfigBuilder = AppLovinSdkInitializationConfiguration.builder(YOUR_SDK_KEY, this)
// initConfigBuilder.mediationProvider = AppLovinMediationProvider.MAX
//
// // Enable test mode by default for the current device. Cannot be run on the main thread.
//// val currentGaid = AdvertisingIdClient.getAdvertisingIdInfo(this).id
//// if (currentGaid != null) {
//// initConfigBuilder.testDeviceAdvertisingIds = Collections.singletonList(currentGaid)
//// }
//
//
// // Initialize the AppLovin SDK
// val sdk = AppLovinSdk.getInstance(this)
// sdk.initialize(initConfigBuilder.build()) {
// LogEx.logDebug(TAG, "max init")
// isAdInit.set(true)
// maxInitAction?.invoke()
// maxInitAction = null
// EventUtils.event("MaxInit", "MaxInit")
// }
// Initialize the AppLovin SDK
val sdk = AppLovinSdk.getInstance(this)
sdk.initialize(initConfigBuilder.build()) {
LogEx.logDebug(TAG, "max init")
isAdInit.set(true)
maxInitAction?.invoke()
maxInitAction = null
EventUtils.event("MaxInit", "MaxInit")
}
executor.shutdown()
}
}
}
\ No newline at end of file
//
// executor.shutdown()
// }
// }
//}
\ No newline at end of file
......@@ -104,7 +104,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:backgroundTint="@color/applovin_sdk_brand_color"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ad_media"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment