Today we’re announcing the release of beta version 13 of the IMA SDK for iOS. This release includes two new major features:

  1. The SDK can be included as a framework in your project.
  2. The SDK now supports ad playing in the background.

    Importing the SDK as a Framework

    Prior to today’s release, importing the SDK involved manually adding every header file to your project, importing every header file individually in your source, and manually including the required frameworks. With the new framework model, you can add a single .framework file to your app and replace all of your header import source lines with a single import statement.

    For CocoaPods Users

    If you use CocoaPods, your build will fail after you update to beta 13. But fear not, you can fix this in a matter of seconds with the following steps:

    1. Locate and remove each instance of an imported IMA header file in your source (these will look like #import “IMA<something>.h”).
    2. Add the following line to the first header or implementation file to access an IMA object:
      @import GoogleInteractiveMediaAds;
      
      
      

      For Manual Importers

      If you don’t use Cocoapods, your path to upgrade is slightly different. You can update using the following steps:

      1. Remove all of the IMA header files and the IMA library file from your project.
      2. Under "Build Phases” > “Link Binary With Libraries”, click the plus sign, select “Add Other...”, and navigate to the downloaded and extracted SDK files. Select GoogleInteractiveMediaAds.framework from whichever folder applies to your implementation (with or without AdMob) and click “Open”.
      3. Follow the two steps above for CocoaPods users.

        Background Ad Playback

        Since our launch, one of the most requested features has been background ad playback. Suppose, for example, you author a music streaming app, and you want to be able to request and play ads in the background. With today’s release, however, we now support requesting and playing ads in a background service. For more info and implementation instructions, see our Background Ad Playback guide.

        As always, if you have any questions feel free to contact us via the support forum.  - 

        Background Ad Playback guide.

        As always, if you have any questions feel free to contact us via the support forum.

Read-Only
Value Description
IMPORTANT
Service
CampaignCriterionService
Entity
CampaignCriterion
Key Name
LocationGroups.locationId
Yes
The Location criterion ID chosen for the LocationGroups criterion from Geographical Targeting or Cities-DMA Regions. For example, an ID of 2752 indicates targeting around location extensions within Sweden.
If this key appears in CampaignCriterion .forwardCompatibilityMap, then re-adding the LocationGroups after removal or using a copy of the LocationGroups may result in a loss of configuration information.

We’re working to support the geographical targets and Cities-DMA regions option in future API versions.

Be on the lookout for an upcoming addition to the Forward Compatibility Map regarding which feed ID will be used for proximity targeting.

Questions? Visit us on the AdWords API Forum or our Google+ page.

Unity 5.0 and ARC

Unity 5.0 has moved out of beta and brings with it support for Automatic Reference Counting (ARC) for iOS. v2.2.1 of the Unity plugin takes advantage of ARC with no additional changes in project settings or code.

The source code and a sample app for the plugin are available on our GitHub repo. A changelog for this release is listed here. If you have any questions about Unity integration, you can reach us on our forum. Remember that you can also find us on Google+, where we have updates on all of our Google Ads developer products.

Select “Mobile applications” in the Tag Type dropdown, and you’ll see the correct ad unit ID and ad unit size for your line item. Armed with those two pieces of info, you’re ready to start coding.

Place a PublisherAdView

DFP banner ads are displayed with the PublisherAdView class. It’s possible to create instances on the fly and add them to a layout programmatically, but the better practice is to define them in your XML layout files. Here’s an example element:

<com.google.android.gms.ads.doubleclick.PublisherAdView
    android:id="@+id/banner_ad"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adSize="320x50"
    ads:adUnitId="/1234567890/DemoAccount/BearRepellent"/>

Note the adSize and adUnitId attributes. These should be set to match the ad unit ID and size shown in the Generate Tags dialog. See our banner guide for more information about setting custom or multiple sizes.

Request an ad

With the PublisherAdView defined in your layout file, you just need to add a few lines of code to its corresponding Java class:

PublisherAdView adView = (PublisherAdView)findViewById(R.id.banner_ad);
PublisherAdRequest request = new PublisherAdRequest.Builder().build();
adView.loadAd(request);

PublisherAdRequest.Builder is a factory class that builds PublisherAdRequest objects. This example uses a simple, unmodified request, but there are a number of ways to add custom targeting, network extras, and test device information when building your own. See the targeting section of our banner guide for details.

Enjoy your line item

With the layout updated and request code in place, your app is ready to show an ad!

Feel free to use the code from this example in your own applications, and if you have any questions, come and see us on our forum.