Commit 8499b51a authored by guest's avatar guest

1

parent 52b90398
......@@ -118,5 +118,5 @@ dependencies {
//work
implementation("androidx.work:work-runtime-ktx:2.7.1") // 请使用最新版本
implementation 'com.google.android.ump:user-messaging-platform:3.0.0'
}
\ No newline at end of file
......@@ -17,6 +17,11 @@ import com.base.datarecovery.fcm.NotificationUtil
import com.base.datarecovery.help.BaseActivity
import com.base.datarecovery.utils.BarUtils
import com.base.datarecovery.utils.EventUtils
import com.google.android.gms.ads.MobileAds
import com.google.android.ump.ConsentInformation
import com.google.android.ump.ConsentRequestParameters
import com.google.android.ump.UserMessagingPlatform
import java.util.concurrent.atomic.AtomicBoolean
@SuppressLint("CustomSplashScreen")
class Splash2Activity : BaseActivity<ActivitySplashBinding>(),
......@@ -56,7 +61,7 @@ class Splash2Activity : BaseActivity<ActivitySplashBinding>(),
finish()
return
}
initSdk()
NotificationUtil.stopNotificationHandler()
jumpType = intent.getIntExtra("actionId", 0)
closeNotification()
......@@ -75,7 +80,41 @@ class Splash2Activity : BaseActivity<ActivitySplashBinding>(),
this.putExtra(CloseNotificationReceiver.NotificationId, jumpType)
})
}
private lateinit var consentInformation: ConsentInformation
private var isMobileAdsInitializeCalled = AtomicBoolean(false)
private fun initSdk(){
val params = ConsentRequestParameters
.Builder()
.build()
consentInformation = UserMessagingPlatform.getConsentInformation(this)
consentInformation.requestConsentInfoUpdate(
this,
params,
{
UserMessagingPlatform.loadAndShowConsentFormIfRequired(
this
) { loadAndShowError ->
if (loadAndShowError != null) {
}
if (consentInformation.canRequestAds()) {
initializeMobileAdsSdk()
}
}
},
{
})
if (consentInformation.canRequestAds()) {
initializeMobileAdsSdk()
}
}
private fun initializeMobileAdsSdk(){
if (isMobileAdsInitializeCalled.getAndSet(true)) {
return
}
MobileAds.initialize(this) {}
}
override fun onAgreePrivacy() {
EventUtils.event("app_start")
if (jumpType == 0) {
......
......@@ -83,7 +83,7 @@ object InstallHelps {
fun requestCfg(callBackAd: Boolean) {
NewComUtils.requestCfg {
if (callBackAd) {
AdmobMaxHelper.initAdmobMaxAd()
// AdmobMaxHelper.initAdmobMaxAd()
}
changeTimerSp()
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
......
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