Posted:

Registering for banner and interstitial ad events is a handy way for Unity developers using the Google Mobile Ads Unity Plugin to track ad lifecycle events -- things like when an ad is loaded or when an ad click causes the app to be backgrounded. For Unity developers deploying to the Android platform, though, it's important to be aware that ad event handler methods are not invoked on the main thread. As a consequence, Unity methods that must be called on the main thread cannot be executed within ad event handler methods.

Consider the following example:

AudioSource audio = GetComponent<AudioSource>();
...
public void HandleInterstitialClosed(object sender, EventArgs args)
{
    audio.mute = false;
}

The code above, which modifies the volume of an audio source from within an ad event handler method, results in the following error:

ArgumentException: set_volume can only be called from the main thread

To get around this, we recommend setting a flag when an event happens, and polling for a state change within the Update() method of your Unity script.

For actions required to be performed on the main thread after showing an ad, set a flag on the OnAdClosed ad event. The update method can poll the value of this flag and perform actions as necessary. The code below illustrates how to implement this approach.

private bool interstitialClosed;

void Start()
{
    InterstitialAd interstitial = new InterstitialAd("YOUR_AD_UNIT_ID");
    interstitial.OnAdClosed += HandleInterstitialClosed;
    interstitialClosed = false;
    ...
}

void Update()
{
    if (interstitialClosed)
    {
        // Perform actions here.
        audio.mute = false;
    }
}

public void HandleInterstitialClosed(object sender, EventArgs args)
{
    interstitialClosed = true;
}

If you have any questions about Unity integration, you can reach us on our forum. You can also find our quick-start guide here. Remember that you can also find us on Google+, where we have updates on all of our Google Ads developer products.

Posted:

The Mobile Ads Garage has returned with its second episode. In this video, you'll see screencasts and detailed breakdowns of how to implement banner ads for both iOS and Android. Plus, you'll get links to guides, samples, and other great resources.


If you like the video, save the Mobile Ads Garage playlist to your YouTube Playlist collection and you'll never miss an episode.

We’d love to hear which AdMob features you’d like to learn more about. The comment sections for the videos are open, and you're welcome to toss out ideas for new episodes and examples you'd like to see. If you have a technical question relating to something discussed in one of the episodes, you can bring it to our support forum.

Posted:

In our ongoing efforts to make developing with the IMA SDK easier, we’re pleased to announce that as of version 3.2.1, the IMA SDK for Android is now available on JCenter.

With this release, it's now quicker than ever to integrate with the IMA SDK. Simply make sure you include JCenter in your list of repositories:

repositories {
   jcenter()
}

Then, in your build.gradle's dependencies, include the following compile directive:

compile 'com.google.ads.interactivemedia.v3:interactivemedia:3.2.1'

If you're modifying an existing sample, make sure to remove the IMA SDK JAR file from your libs folder. This directive includes the SDK, and if you already have the SDK JAR in libs, you’ll get errors for having two copies of the same library.

If you have any questions about these changes, feel free to contact us via the support forum.

Posted:
When managing multiple AdWords accounts, it’s critical to identify underperforming ads and accounts in a timely manner. For account managers, these alerts are useful information to promptly solve issues and maintain ads quality.

To reduce the technical barrier of the alerting workflow implementation, we are happy to announce Alerting Framework on Adwords, an open source Java framework for large scale AdWords API alerting. This framework is capable of generating alerts for all accounts under the specified manager account, which includes downloading AdWords report data, combining it with other data feeds, processing them to trigger relevant alerts, and delivering the alert messages to the proper destination. You can use our sample alerts to explore how it works, or set up your own alerting logic by implementing custom alert entities and plugging them into the system.

Get started at the Alerting Framework on AdWords GitHub repository. If you have any questions or would like to provide feedback, please visit the project issue tracker, AdWords API Forum, or our Google+ page.

Posted:

We’re pleased to announce that the latest version of the IMA SDK for iOS, 3.2.0, supports compiling with bitcode enabled.

To enable/disable bitcode, go into Build Settings in your XCode project and toggle the 'Enable Bitcode' build option. For more information on bitcode, please see the developer documentation.

If you have any questions about these changes, feel free to contact us via the support forum.

Posted:

Today, the first episode of the Mobile Ads Garage hits YouTube! The Mobile Ads Garage is a new series that covers how to use the Mobile Ads SDK to display ads from AdMob and Doubleclick For Publishers. Each episode will cover one aspect of the SDK, break down a feature, and show screencasts of real implementations on both Android and iOS – all in a friendly format.

The series will make its home on YouTube's Google Developer Channel, where you'll find the first episode in the Mobile Ads Garage playlist along with a sneak peek of the next four.


In addition to being a new way that people can find out about the SDK and how to use it, the series is a way for publishers to let us know what features they'd like to learn more about. The comment sections for the videos are open, and you're welcome to toss out ideas for new episodes and examples you'd like to see. If you have a technical question relating to something discussed in one of the episodes, you can bring it to our support forum.

Posted:

Have you ever wished you could experiment with IMA HTML5 SDK features without having to download our samples, modify them for the feature, and host them on your own webserver? Now you can with our new Codepen snippets!

We’ve added codepen snippets to several HTML5 guides. These snippets allow you to modify and execute Javascript right in your browser. To test different aspects of a new feature, you can simply modify the Javascript and re-run the sample, without having to download the files or host them yourself. Codepen snippets are now available for the following guides:

For more information, check out the guides above. We’ll continue to add codepen snippets to new guides as they are released, so keep an eye out! As always, if you have any questions, feel free to contact us via the support forum.

Posted:
Starting in late April, 2016, AdWords will begin rolling out a new calculation for impression share, which will potentially affect your reports in the AdWords API if you rely on impression share columns and run Video Campaigns.

Historically, a small percentage of impressions on YouTube videos were not being included in the calculation of the impression share columns. We've implemented an improved algorithm to more accurately count impression share volume that now accounts for these impressions.

We plan to roll out the improved calculation over the next few months for all accounts and impressions, so if you run campaigns on YouTube, your impression share statistics will become more accurate when your account goes live.

If you have any questions about this change, or other questions about the AdWords API, please contact us via the forum or the Ads Developers Plus Page.

Posted:

On Tuesday, May 31, 2016, in accordance with the deprecation schedule, v201502 of the DFP API will be sunset. At that time, any requests made to v201502 will return errors.

If you're still using v201502, now's the time to upgrade to the latest release and take advantage of new features like vCPM support. To do so, check the release notes to identify any breaking changes, grab the latest version of your client library and update your code.

Some changes to look out for:

This is not an exhaustive list, so as always, don't hesitate to reach out to us with any questions. To be notified of future deprecations and sunsets, join the DFP API Sunset Announcements group and adjust your notification settings.

Posted:

Since its release a few years ago, Swift has evolved into a dynamic, modern programming language for developing iOS apps. With its growing popularity and open source, we’ve seen an increase in requests from our publishers to fully support Swift in the Google Mobile Ads SDK. We responded by releasing a complete set of example apps built in Swift, adding Swift code snippets throughout our developer docs, and adding Swift API reference docs to our developer sites.

Our GitHub repo now has Swift example apps for banners, interstitials, and native ads for both AdMob and DFP. We’ve also added a Swift version of our API Demo app. The API Demo app demonstrates features of the Google Mobile Ads SDK, such as new ways to customize ad requests, experiment with multiple ad sizes, and compare AdMob and DFP technologies, to help you improve the user experience and maximize ad revenue.

We’ve also added Swift code snippets to our AdMob, DFP, and AdX developer docs. With nicely formatted widgets that display Swift and Objective-C code side by side, you can now easily compare SDK implementations in both Swift and Objective-C.

Finally, we’ve added Swift API reference docs to our AdMob and DFP developer sites, providing full documentation of our iOS Google Mobile Ads SDK. Now you have access to API reference docs for both Swift and Objective-C, making it easier to integrate with our SDK.

The Google Mobile Ads SDK team is committed to supporting Swift, and we’ll continue to update our SDK, developer docs, and example apps to ensure we provide publishers with full support for the latest version of Swift. Whether you currently develop your iOS apps in Swift, or have plans to do so in the future, we hope the actions we’ve taken to support Swift in our SDK will help make your experience with Swift more enjoyable and your transition to Swift a whole lot easier.

If you have any questions or feedback regarding our SDK or Swift support, feel free to contact us through our forum.

Posted:
Today we're releasing v2.5beta1 of the DCM/DFA Reporting and Trafficking API. This release provides a preview of features we're working on for future versions of the API. Experimental functionality being showcased includes: Details of these and all other changes are covered in our release notes.

Be aware that the functionality being previewed here is subject to change and may not appear in subsequent releases. For these reasons, this API version is not recommended for production usage. We do however welcome you to test out these new features and let us know what you think!