Friday, January 17, 2014

Google Ads Developer Blog

Google Ads Developer Blog


New Google Mobile Ads SDK Adds Support for DFP, Search Ads, and Ad Exchange

Posted: 16 Jan 2014 02:52 PM PST

Today, we're excited to announce the launch of new Google Mobile Ads APIs as part of the Google Play services 4.1 update. The update includes:

  • Support for DoubleClick for Publishers (DFP), Search Ads for Apps, and DoubleClick Ad Exchange
  • A new location API

DoubleClick for Publishers

This release adds new DFP specific APIs to the com.google.android.gms.ads.doubleclick package. For example, you can use the new APIs to request a 320x50 banner ad from DFP as follows:


PublisherAdView adView = new PublisherAdView(this);
adView.setAdUnitId("MY_DFP_AD_UNIT_ID");
adView.setAdSizes(AdSize.BANNER);
LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);
layout.addView(adView);
PublisherAdRequest request = new PublisherAdRequest.Builder().build();
adView.loadAd(request);

Check out the DFP docs for more examples on how to use the new DFP APIs. If you're migrating from the old AdMob Android SDK to Google Play services, be sure to also consult our migration guide which summarizes implementation details for the new APIs.

Search Ads for Apps

Search Ads for Apps support has also been added in this release, with new APIs in the com.google.android.gms.ads.search package. A search ads banner request in Google Play services looks like this:


SearchAdView adView = new SearchAdView(this);
adView.setAdUnitId("MY_ADSENSE_ID");
adView.setAdSize(new AdSize(320, 60));
LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);
layout.addView(adView);
SearchAdRequest request = new SearchAdRequest.Builder()
.setQuery("flower")
.build();
adView.loadAd(request);

Consult the Search Ads documentation for more information on how to customize your SearchAdRequest.

DoubleClick Ad Exchange

The latest release now supports DoubleClick Ad Exchange, which shares the same AdView and AdRequest classes with AdMob in Google Play Services:


adView = new AdView(this);
adView.setAdUnitId("MY_AD_EXCHANGE_ID");
adView.setAdSize(AdSize.BANNER);
LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);
layout.addView(adView);
AdRequest request = new AdRequest.Builder().build();
adView.loadAd(request);

See the Ad Exchange documentation for more information on implementing Ad Exchange with the new library.

Location

We've added back the setLocation method to enable you to provide location to an ad request. Note that location should only be provided if your app already makes use of location.

Assuming you've grabbed location via a suitable method, you can pass the location when building an AdRequest:


Location location = … // get location.
AdRequest request = AdRequest.Builder().setLocation(location).build();

The new library can be downloaded from Android's SDK manager. Consult the setup guide for detailed installation instructions. You can see a full list of changes on our release notes page.

Give us a shout on our forum with any questions or concerns about the release, and stay tuned on our G+ page for the latest updates (and maybe even a tips/tricks campaign!) on Google Mobile Ads APIs.

IMA SDK Samples are now available on GitHub

Posted: 16 Jan 2014 01:12 PM PST

The IMA SDK samples (Flash, HTML5, iOS and Android) have been moved to GitHub under the Google Ads organization. You can find the links to these repos on the updated downloads page.

With the move to GitHub, you'll no longer have to clobber your existing sample files to get updates - you can clone the repo and pull updates as they're released. If you like the old way, we've got you covered - you can still get the zipped samples from the downloads page.

Note: The IMA SDK binaries have not been moved to GitHub.

If you have any questions about the IMA SDK, contact us on the forum. Keep an eye on our Google+ page for announcements and updates.

No comments:

Post a Comment