Skip to content

Commit

Permalink
Version 3.0.3 of the Google Mobile Ads Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Ram Parameswaran committed Mar 14, 2016
1 parent 4ff5f52 commit f1cad43
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Google Mobile Ads Unity Plugin Change Log

*************
Version 3.0.3
*************
- Restrict simultaneous rewarded video requests on Android.

Built and tested with:
- Google Play Services 8.4.0
- Google Mobile Ads iOS SDK 7.7.0

*************
Version 3.0.2
*************
Expand Down
Binary file modified GoogleMobileAds.unitypackage
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ public class RewardBasedVideo {
*/
private boolean isLoaded;

/**
* Whether or not there is an ad request in progress.
*/
private boolean isLoading;

private final Object mLock = new Object();

public RewardBasedVideo(Activity activity, UnityRewardBasedVideoAdListener adListener) {
this.activity = activity;
this.adListener = adListener;
this.isLoaded = false;
this.isLoading = false;
}

/**
Expand All @@ -68,13 +76,19 @@ public void run() {
rewardBasedVideo.setRewardedVideoAdListener(new RewardedVideoAdListener() {
@Override
public void onRewardedVideoAdLoaded() {
isLoaded = true;
adListener.onAdLoaded();
synchronized (mLock) {
isLoaded = true;
isLoading = false;
adListener.onAdLoaded();
}
}

@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
adListener.onAdFailedToLoad(PluginUtils.getErrorReason(errorCode));
synchronized (mLock) {
isLoading = false;
adListener.onAdFailedToLoad(PluginUtils.getErrorReason(errorCode));
}
}

@Override
Expand Down Expand Up @@ -121,7 +135,16 @@ public void run() {
if (extras != null) {
extras.putBoolean("_noRefresh", true);
}
rewardBasedVideo.loadAd(adUnitId, request);
synchronized (mLock) {
if (!isLoading) {
isLoading = true;
rewardBasedVideo.loadAd(adUnitId, request);
} else {
Log.w(PluginUtils.LOGTAG, "Cannot make a new rewarded video ad request "
+ "until previous request has completed.");
}
}

}
});
}
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 @@ -20,7 +20,7 @@ namespace GoogleMobileAds.Api
{
public class AdRequest
{
public const string Version = "3.0.2";
public const string Version = "3.0.3";
public const string TestDeviceSimulator = "SIMULATOR";

public class Builder
Expand Down

0 comments on commit f1cad43

Please sign in to comment.