Skip to content

Commit

Permalink
Google/20.6.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
prod-applovin-deploy committed Feb 28, 2022
1 parent 5ec89cf commit d68a600
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Google/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 20.6.0.1
* Fix AdChoices `getLocalExtraParameters()` crash. Publishers can set a custom placement on AppLovin SDKs 11.0.0+ and the placement is defaulted to the top right corner otherwise.

## 20.6.0.0
* Certified with Google SDK 20.6.0.

Expand Down
2 changes: 1 addition & 1 deletion Google/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
private val versionMajor = 20
private val versionMinor = 6
private val versionPatch = 0
private val versionAdapterPatch = 0
private val versionAdapterPatch = 1

val libraryVersionName by extra("${versionMajor}.${versionMinor}.${versionPatch}.${versionAdapterPatch}")
val libraryVersionCode by extra((versionMajor * 1000000) + (versionMinor * 10000) + (versionPatch * 100) + versionAdapterPatch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public void loadAdViewAd(final MaxAdapterResponseParameters parameters, final Ma
if ( isNative )
{
NativeAdOptions.Builder nativeAdOptionsBuilder = new NativeAdOptions.Builder();
nativeAdOptionsBuilder.setAdChoicesPlacement( getAdChoicesPlacement( parameters.getLocalExtraParameters() ) );
nativeAdOptionsBuilder.setAdChoicesPlacement( getAdChoicesPlacement( parameters ) );
nativeAdOptionsBuilder.setRequestMultipleImages( adFormat == MaxAdFormat.MREC ); // MRECs can handle multiple images via AdMob's media view

NativeAdViewListener nativeAdViewListener = new NativeAdViewListener( parameters, adFormat, activity, listener );
Expand Down Expand Up @@ -521,7 +521,7 @@ public void loadNativeAd(final MaxAdapterResponseParameters parameters, final Ac
AdRequest adRequest = createAdRequestWithParameters( isBiddingAd, parameters, activity );

NativeAdOptions.Builder nativeAdOptionsBuilder = new NativeAdOptions.Builder();
nativeAdOptionsBuilder.setAdChoicesPlacement( getAdChoicesPlacement( parameters.getLocalExtraParameters() ) );
nativeAdOptionsBuilder.setAdChoicesPlacement( getAdChoicesPlacement( parameters ) );

// Medium templates can handle multiple images via AdMob's media view
String template = BundleUtils.getString( "template", "", parameters.getServerParameters() );
Expand Down Expand Up @@ -746,11 +746,19 @@ private boolean isValidNativeAd(final NativeAd nativeAd)
return nativeAd.getHeadline() != null;
}

private int getAdChoicesPlacement(Map<String, Object> localExtraParams)
private int getAdChoicesPlacement(MaxAdapterResponseParameters parameters)
{
// Publishers can set via nativeAdLoader.setLocalExtraParameter( "admob_ad_choices_placement", ADCHOICES_BOTTOM_LEFT );
final Object adChoicesPlacementObj = localExtraParams.get( "admob_ad_choices_placement" );
return isValidAdChoicesPlacement( adChoicesPlacementObj ) ? (Integer) adChoicesPlacementObj : NativeAdOptions.ADCHOICES_TOP_RIGHT;
// Note: This feature requires AppLovin v11.0.0+
if ( AppLovinSdk.VERSION_CODE >= 11_00_00_00 )
{
final Map<String, Object> localExtraParams = parameters.getLocalExtraParameters();
final Object adChoicesPlacementObj = localExtraParams != null ? localExtraParams.get( "admob_ad_choices_placement" ) : null;

return isValidAdChoicesPlacement( adChoicesPlacementObj ) ? (Integer) adChoicesPlacementObj : NativeAdOptions.ADCHOICES_TOP_RIGHT;
}

return NativeAdOptions.ADCHOICES_TOP_RIGHT;
}

private boolean isValidAdChoicesPlacement(Object placementObj)
Expand Down

0 comments on commit d68a600

Please sign in to comment.