Skip to content

Commit

Permalink
AdMob 4.22.3.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
chauduyphanvu committed Nov 3, 2023
1 parent 65e7dcd commit 572f149
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion AdMobAdapter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
minSdk = 21
targetSdk = 33
// If you touch the following line, don't forget to update scripts/get_rc_version.zsh
android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "4.22.3.0.3"
android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "4.22.3.0.4"

buildConfigField(
"String",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback
import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAd
import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAdLoadCallback
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
Expand All @@ -49,9 +50,13 @@ class AdMobAdapter : PartnerAdapter {
else value.joinToString()
}"
)
MobileAds.setRequestConfiguration(
RequestConfiguration.Builder().setTestDeviceIds(value).build()
)

// There have been known ANRs when calling setRequestConfiguration() on the main thread.
CoroutineScope(IO).launch {
MobileAds.setRequestConfiguration(
RequestConfiguration.Builder().setTestDeviceIds(value).build()
)
}
}

/**
Expand Down Expand Up @@ -211,16 +216,19 @@ class AdMobAdapter : PartnerAdapter {
else COPPA_NOT_SUBJECT
)

MobileAds.setRequestConfiguration(
MobileAds.getRequestConfiguration().toBuilder()
.setTagForChildDirectedTreatment(
if (isSubjectToCoppa) {
RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE
} else {
RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE
}
).build()
)
// There have been known ANRs when calling setRequestConfiguration() on the main thread.
CoroutineScope(IO).launch {
MobileAds.setRequestConfiguration(
MobileAds.getRequestConfiguration().toBuilder()
.setTagForChildDirectedTreatment(
if (isSubjectToCoppa) {
RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE
} else {
RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE
}
).build()
)
}
}

/**
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Note the first digit of every adapter version corresponds to the major version of the Chartboost Mediation SDK compatible with that adapter.
Adapters are compatible with any Chartboost Mediation SDK version within that major version.

### 4.22.3.0.4
- Offload `setRequestConfiguration()` calls to background threads to avoid ANRs.

### 4.22.3.0.3
- Add support for adaptive banner sizes.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Chartboost Mediation AdMob adapter mediates AdMob via the Chartboost Mediati

In your `build.gradle`, add the following entry:
```
implementation "com.chartboost:chartboost-mediation-adapter-admob:4.22.3.0.3"
implementation "com.chartboost:chartboost-mediation-adapter-admob:4.22.3.0.4"
```

## Contributions
Expand Down

0 comments on commit 572f149

Please sign in to comment.