Today we’re announcing the release of beta version 13 of the IMA SDK for iOS. This release includes two new major features:
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.
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:
#import “IMA<something>.h”).
- 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:
- Remove all of the IMA header files and the IMA library file from your project.
- 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”.
- 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.
LocationGroups
after removal or using a copy of the LocationGroups
may result in a loss of configuration information.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.
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.
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.
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.