Skip to content

Commit

Permalink
Version 3.12.0 of the Google Mobile Ads Unity plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rampara committed Mar 10, 2018
1 parent d562d72 commit 1f339d3
Show file tree
Hide file tree
Showing 25 changed files with 108 additions and 163 deletions.
18 changes: 18 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
Google Mobile Ads Unity Plugin Change Log

**************
Version 3.12.0
**************

Plugin:
- Add `setUserId` API to rewarded video ads to identify users in
server-to-server reward callbacks.
- Remove functionality that forced ad events to be invoked on the
main thread.

Mediation packages:
- Updated maio Unity package to v1.0.1.

Built and tested with:
- Google Play services 11.8.0
- Google Mobile Ads iOS SDK 7.29.0
- Unity Jar Resolver 1.2.61.0

**************
Version 3.11.1
**************
Expand Down
9 changes: 6 additions & 3 deletions mediation/Maio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# maio Adapter plugin for Google Mobile Ads SDK for Unity 3D Changelog

## 1.0.0
## 1.0.1
- Supports maio Android SDK version 1.0.7.
- Supports maio iOS SDK version 1.2.19.

## 1.0.0
- First release!
- Supports Android adapter version 1.0.6.0.
- Supports iOS adapter version 1.2.18.0.
- Supports maio Android SDK version 1.0.6.
- Supports maio iOS SDK version 1.2.18.
2 changes: 1 addition & 1 deletion mediation/Maio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ project.ext {
'UNITY_EXE environment variable and point it to your Unity installation.')
}

versionString = '1.0.0'
versionString = '1.0.1'
pluginName = 'GoogleMobileAdsMaioMediation'
pluginFileName = "${pluginName}.unitypackage"
zipName = "${pluginName}-${versionString}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<dependencies>
<androidPackages>
<androidPackage spec="com.google.ads.mediation:maio:1.0.6.0">
<androidPackage spec="com.google.ads.mediation:maio:1.0.7.1">
<repositories>
<repository>https://jcenter.bintray.com/</repository>
</repositories>
</androidPackage>
<androidPackage spec="com.maio:android-sdk:1.0.6">
<androidPackage spec="com.maio:android-sdk:1.0.7">
<repositories>
<repository>https://imobile-maio.github.io/maven</repository>
</repositories>
</androidPackage>
</androidPackages>

<iosPods>
<iosPod name="GoogleMobileAdsMediationMaio" version="1.2.18.0">
<iosPod name="GoogleMobileAdsMediationMaio" version="1.2.19.0">
<sources>
<source>https://github.com/CocoaPods/Specs</source>
</sources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ public boolean isLoaded() {
return isLoaded;
}

/**
* Sets the user ID to be used in server-to-server reward callbacks.
*/
public void setUserId(final String userId) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
rewardBasedVideo.setUserId(userId);
}
});
}

/**
* Shows the reward based video ad if it has loaded.
*/
Expand Down
9 changes: 2 additions & 7 deletions source/plugin/Assets/GoogleMobileAds/Api/AdLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,17 @@ private AdLoader(Builder builder)
BindingFlags.Static | BindingFlags.Public);
this.adLoaderClient = (IAdLoaderClient)method.Invoke(null, new object[] { this });

Utils.CheckInitialization();

this.adLoaderClient.OnCustomNativeTemplateAdLoaded +=
delegate (object sender, CustomNativeEventArgs args)
{
if (this.OnCustomNativeTemplateAdLoaded != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnCustomNativeTemplateAdLoaded(this, args));
}
this.OnCustomNativeTemplateAdLoaded(this, args);
};
this.adLoaderClient.OnAdFailedToLoad += delegate (
object sender, AdFailedToLoadEventArgs args)
{
if (this.OnAdFailedToLoad != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdFailedToLoad(this, args));
this.OnAdFailedToLoad(this, args);
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace GoogleMobileAds.Api
{
public class AdRequest
{
public const string Version = "3.11.1";
public const string Version = "3.12.0";
public const string TestDeviceSimulator = "SIMULATOR";

private AdRequest(Builder builder)
Expand Down
12 changes: 5 additions & 7 deletions source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public BannerView(string adUnitId, AdSize adSize, AdPosition position)
this.client = (IBannerClient)method.Invoke(null, null);
client.CreateBannerView(adUnitId, adSize, position);

Utils.CheckInitialization();
ConfigureBannerEvents();
}

Expand All @@ -49,7 +48,6 @@ public BannerView(string adUnitId, AdSize adSize, int x, int y)
this.client = (IBannerClient)method.Invoke(null, null);
client.CreateBannerView(adUnitId, adSize, x, y);

Utils.CheckInitialization();
ConfigureBannerEvents();
}

Expand Down Expand Up @@ -118,39 +116,39 @@ private void ConfigureBannerEvents()
{
if (this.OnAdLoaded != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLoaded(this, args));
this.OnAdLoaded(this, args);
}
};

this.client.OnAdFailedToLoad += (sender, args) =>
{
if (this.OnAdFailedToLoad != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdFailedToLoad(this, args));
this.OnAdFailedToLoad(this, args);
}
};

this.client.OnAdOpening += (sender, args) =>
{
if (this.OnAdOpening != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdOpening(this, args));
this.OnAdOpening(this, args);
}
};

this.client.OnAdClosed += (sender, args) =>
{
if (this.OnAdClosed != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdClosed(this, args));
this.OnAdClosed(this, args);
}
};

this.client.OnAdLeavingApplication += (sender, args) =>
{
if (this.OnAdLeavingApplication != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLeavingApplication(this, args));
this.OnAdLeavingApplication(this, args);
}
};
}
Expand Down
11 changes: 5 additions & 6 deletions source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,44 +34,43 @@ public InterstitialAd(string adUnitId)
this.client = (IInterstitialClient)method.Invoke(null, null);
client.CreateInterstitialAd(adUnitId);

Utils.CheckInitialization();
this.client.OnAdLoaded += (sender, args) =>
{
if (this.OnAdLoaded != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLoaded(this, args));
this.OnAdLoaded(this, args);
}
};

this.client.OnAdFailedToLoad += (sender, args) =>
{
if (this.OnAdFailedToLoad != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdFailedToLoad(this, args));
this.OnAdFailedToLoad(this, args);
}
};

this.client.OnAdOpening += (sender, args) =>
{
if (this.OnAdOpening != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdOpening(this, args));
this.OnAdOpening(this, args);
}
};

this.client.OnAdClosed += (sender, args) =>
{
if (this.OnAdClosed != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdClosed(this, args));
this.OnAdClosed(this, args);
}
};

this.client.OnAdLeavingApplication += (sender, args) =>
{
if (this.OnAdLeavingApplication != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLeavingApplication(this, args));
this.OnAdLeavingApplication(this, args);
}
};
}
Expand Down
1 change: 0 additions & 1 deletion source/plugin/Assets/GoogleMobileAds/Api/MobileAds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class MobileAds
public static void Initialize(string appId)
{
client.Initialize(appId);
MobileAdsEventExecutor.Initialize();
}

public static void SetApplicationMuted(bool muted)
Expand Down
12 changes: 5 additions & 7 deletions source/plugin/Assets/GoogleMobileAds/Api/NativeExpressAdView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public NativeExpressAdView(string adUnitId, AdSize adSize, AdPosition position)
this.client = (INativeExpressAdClient)method.Invoke(null, null);
this.client.CreateNativeExpressAdView(adUnitId, adSize, position);

Utils.CheckInitialization();
ConfigureNativeExpressAdEvents();
}

Expand All @@ -49,7 +48,6 @@ public NativeExpressAdView(string adUnitId, AdSize adSize, int x, int y)
this.client = (INativeExpressAdClient)method.Invoke(null, null);
this.client.CreateNativeExpressAdView(adUnitId, adSize, x, y);

Utils.CheckInitialization();
ConfigureNativeExpressAdEvents();
}

Expand Down Expand Up @@ -94,39 +92,39 @@ private void ConfigureNativeExpressAdEvents()
{
if (this.OnAdLoaded != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLoaded(this, args));
this.OnAdLoaded(this, args);
}
};

this.client.OnAdFailedToLoad += (sender, args) =>
{
if (this.OnAdFailedToLoad != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdFailedToLoad(this, args));
this.OnAdFailedToLoad(this, args);
}
};

this.client.OnAdOpening += (sender, args) =>
{
if (this.OnAdOpening != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdOpening(this, args));
this.OnAdOpening(this, args);
}
};

this.client.OnAdClosed += (sender, args) =>
{
if (this.OnAdClosed != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdClosed(this, args));
this.OnAdClosed(this, args);
}
};

this.client.OnAdLeavingApplication += (sender, args) =>
{
if (this.OnAdLeavingApplication != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLeavingApplication(this, args));
this.OnAdLeavingApplication(this, args);
}
};
}
Expand Down
21 changes: 13 additions & 8 deletions source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,60 +43,59 @@ private RewardBasedVideoAd()
this.client = (IRewardBasedVideoAdClient)method.Invoke(null, null);
client.CreateRewardBasedVideoAd();

Utils.CheckInitialization();
this.client.OnAdLoaded += (sender, args) =>
{
if (this.OnAdLoaded != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLoaded(this, args));
this.OnAdLoaded(this, args);
}
};

this.client.OnAdFailedToLoad += (sender, args) =>
{
if (this.OnAdFailedToLoad != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdFailedToLoad(this, args));
this.OnAdFailedToLoad(this, args);
}
};

this.client.OnAdOpening += (sender, args) =>
{
if (this.OnAdOpening != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdOpening(this, args));
this.OnAdOpening(this, args);
}
};

this.client.OnAdStarted += (sender, args) =>
{
if (this.OnAdStarted != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdStarted(this, args));
this.OnAdStarted(this, args);
}
};

this.client.OnAdClosed += (sender, args) =>
{
if (this.OnAdClosed != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdClosed(this, args));
this.OnAdClosed(this, args);
}
};

this.client.OnAdLeavingApplication += (sender, args) =>
{
if (this.OnAdLeavingApplication != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLeavingApplication(this, args));
this.OnAdLeavingApplication(this, args);
}
};

this.client.OnAdRewarded += (sender, args) =>
{
if (this.OnAdRewarded != null)
{
MobileAdsEventExecutor.executeInUpdate(() => this.OnAdRewarded(this, args));
this.OnAdRewarded(this, args);
}
};
}
Expand Down Expand Up @@ -134,6 +133,12 @@ public void Show()
client.ShowRewardBasedVideoAd();
}

// Sets the user id of current user.
public void SetUserId(string userId)
{
client.SetUserId(userId);
}

// Returns the mediation adapter class name.
public string MediationAdapterClassName()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ public interface IRewardBasedVideoAdClient

// Shows the reward based video ad on the screen.
void ShowRewardBasedVideoAd();

// Sets the user id of current user.
void SetUserId(string userId);
}
}
Loading

0 comments on commit 1f339d3

Please sign in to comment.