Yahoo Mobile SDK Integration

Integration Prerequisites

The Yahoo Mobile SDK is available for both Android and iOS platforms.

Android Prerequisites iOS Prerequisites
Android version 4.4 and up (API level 19+) iOS 11+
Build environment with Java 11 Xcode 13.0+
Gradle-based build system CocoaPods 1.8.4+

Account Setup for Placements

Before you can display ads within your app, you’ll need a Site ID which was provided to you by your Account Manager during onboarding. You may also retrieve your Site ID by logging in to the Yahoo SSP. Please reach out to your Account Manager if you do not have access to the Yahoo SSP or the Site ID. You will need the Site ID before proceeding with the next steps.

Configure Your Project

The Yahoo Mobile SDK is available via this Maven repository for Android and CocoaPods for iOS. Starting with the 1.1.0 release, iOS also supports installation via Swift Package Manager.

If you want to use Swift Package Manager to add the SDK to your project, follow the instructions in the YahooMobileSDK-SwiftPackage README. Otherwise, add the SDK to your project by adding the following lines to your build.gradle or Podfile:

// Build.gradle
dependencies {
  implementation 'com.yahoo.mobile.ads:android-yahoo-mobile-sdk:1.2.0'
  implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30'
  implementation 'com.google.android.gms:play-services-ads-identifier:17.1.0'
  implementation 'androidx.browser:browser:1.3.0'
}
compileOptions {
  sourceCompatibility JavaVersion.VERSION_1_8
  targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
  maven {
    url 'https://artifactory.yahooinc.com/artifactory/maven/'
  }
}
platform :ios, '11.0'

target 'MyApp' do
  use_frameworks!
  project "MyApp.xcproj"
  pod 'Yahoo-Mobile-SDK', '1.2.0'
end

[iOS Only] Enable SKAdNetwork

The Yahoo Mobile SDK supports attribution tracking via Apple’s SKAdNetwork framework. This allows Yahoo as well as participating third-party ad buyers to attribute app installs in the absence of the mobile device ID such as IDFA, which was removed due to the App Tracking Transparency introduced in iOS version 14.5.

Update your app’s Info.plist file and add a SKAdNetworkItems key with an additional dictionary that includes Yahoo’s SKAdnetwork ID, as well as our third-party buyers’ SKAdnetwork IDs. An up to date list of our 3rd party buyers is available here. In addition, you will also need to add your app’s App Store ID in YahooAdsSourceAppId key. See example below.

<key>SKAdNetworkItems</key>
 <array>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>e5fvkxwrpn.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>4fzdc2evr5.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>cg4yq2srnc.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>c6k4g5qg8m.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>hs6bdukanm.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>9rd848q2bz.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>klf5c3l5u5.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>8s468mfl3y.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>uw77j35x4d.skadnetwork</string>
	</dict>
</array>

<key>YahooAdsSourceAppId</key>
 	<string>Replace_this_with_your_App's_App_Store_ID</string> 

Permissions

Android

Location

It is recommended, but not required, that the ACCESS_FINE_LOCATION permission is also added to your AndroidManifest.xml so that the Yahoo Mobile SDK can utilize the location data for targeting purposes to provide more relevant demand. See the sample app for examples on how to request permissions from users at runtime.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

iOS

Location

It is recommended, but not required, that location permissions are requested so that the Yahoo Mobile SDK can utilize location data for targeting purposes to provide more relevant demand. See the link above and the sample app for examples on how to configure your Info.plist and then request permissions from users at runtime.

Initializing the SDK

// Initialization should occur within the onCreate method of your Application subclass. Calling this method anywhere else is not supported

// Import the edition into your project
import com.yahoo.ads.YASAds;

// Initialize the SDK with your Site ID
YASAds.initialize(myApp, <YOUR SITE ID>);
// Initialization should occur within the onCreate method of your Application subclass. Calling this method anywhere else is not supported

// Import the edition into your project
import com.yahoo.ads.YASAds

// Initialize the SDK with your Site ID
YASAds.initialize(myApp, <YOUR SITE ID>)
// A best practice for initializing is in the app delegate’s application:didFinishLaunchingWithOptions: method

// Import Yahoo Mobile into your project
#import <YahooAds/YahooAds.h>

// Initialize the edition with your Site ID
[YASAds initializeWithSiteId: <YOUR_SITE_ID>];
// A best practice for initializing is in the app delegate’s application(_:didFinishLaunchingWithOptions:) method

// Import Yahoo Mobile into your project
import YahooAds

// Initialize the edition with your site ID
YASAds.initialize(withSiteId:<YOUR_SITE_ID>)

For Android ProGuard Users

If using ProGuard to minify your app, include the following in your ProGuard config file:

-keepclassmembers class com.yahoo** {
public *;
}
-keep class com.yahoo**

Next Steps