Introduction
The purpose of this article is to guide publishers who want to use the Fyber FairBid SDK to load and display ads from Snap Audience Network via FairBid mediation.
Note
Snap Audience Network is still operating within Beta. If you are new to Snap Audience Network, first apply to Snap to request access. You can do so by completing this form or send an email to adkit-support@snapchat.com
This is a five-step process:
- Create or login to your Snap Account
- Create an app in Snap
- Create a placement (Slot ID) for your app
- Retrieve and enter the parameters from the Snap dashboard
- Add the Snap SDK to your integration
Note
Snap currently supports the following ad formats and for vertical display only:
- Interstitials
- Rewarded Videos
- Banner
Refer to Snap for updates on supported ad formats.
Step 1: Create or Login to your Snap Account
Click here, to log in to your Snap account. In case you don't have a Snap account yet, please apply for access by filling out this form or send an email to the following address
adkit-support@snapchat.com.
Step 2: Create an App in Snap
Click the appropriate link Android or iOS and follow the instructions to set-up your app in Snap.
Step 3: Create a Placement for your App
Refer to your Snap Account Manager to create a Placement (Slot ID) for your App. For any additional support, use the following email address adkit-support@snapchat.com.
Step 4: Retrieve and Enter the Parameters from the Snap Dashboard into Fyber's Dashboard
To enable Snap to work as an Ad Network on the FairBid Mediation platform, you must obtain six parameters from your Snap account and later insert them into the Fyber Console.
Set out below are the details of what parameters are required, how and where to obtain them.
The required parameters depend on whether you are configuring the network at the App Level or Placement Level in the Fyber console.
Snap Parameter | Description | Fyber App / Placement |
---|---|---|
Organization ID | The unique ID of your app in the Snap system. | Both |
Client ID | This is the unique identifier detailing the relationship between your account with Snap. | Both |
Client Secret | Another unique identifier detailing the relationship between your account and Snap. | Both |
Refresh Token | The refresh token the client application already received | Both |
Account ID | The identifier of the account associated with Snap | Both |
Slot ID | The identifier of the placement (slot) created on Snap's dashboard which you'll need to insert while creating instances | Both |
Alternatively, watch and listen to the video below to find out how to obtain the required parameters:
Retrieving the Snap Parameters
To obtain the required parameters from Snap:
- Sign-in to your Fyber account.
- Select your app from the App Management window.
- On the App Management page, click Mediated Networks.
- Select Snap from the list
The Snap configuration window opens and the credentials are already entered:
The credentials are automatically completed in the window
Note
If you are configuring the mediated network at the app level, fewer credentials may be required.
- Click Save.
- To complete the setup, you must associate the network instance that you just created to the relevant Placement set up on the Fyber Dashboard. For a detailed guide click here.
Step 5: Adding the Snap SDK to your Integration
To add the Snap SDK go to the Supported Networks page and follow the guide while selecting the Configuration for Snap Audience Network.
Notes for integrating Snap Audience Network on Android
Minimum supported API version
Warning
Snap minimum supported API version is 19
Depending on your build requirements some actions might be required
If your app's minimum supported API version is below 19, you'll see the following compilation error
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [com.unity3d.ads:unity-ads:3.5.1] /Users/user/.gradle/caches/transforms-2/files-2.1/ead8d3090140b34c4c0a49b2c10999cf/unity-ads-3.5.1/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="com.snap.adkit.distribution" to force usage (may lead to runtime failures)
If raising your applications' minimum supported version is not an option, nor is it removing Snap from your integration, we suggest the following workaround:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.sample">
<uses-sdk tools:overrideLibrary="com.snap.adkit.distribution"/>
This AndroidManifest will override any conflicting Manifest configuration coming from Snap with the ones defined in your application (that includes minimum supported API version).
Despite being the suggested solution (from both Fyber and Gradle ) this comes with potential side effects and should be used wisely.
Warning
When running on devices below API 19, the SDK will proactively not start Snap SDK and will therefore always return no fills.
Ad loaded limit
Due to a limitation on Snap SDK on the current version, v1.0.3.4, it's only possible to load one ad at any given moment. If you plan on using Snap in your integration, we currently recommend disabling auto-request for any of the placements that include a Snap instance with high eCPM.
Tablets
Snap does not officially support tablets. Snap is likely to either not have ads available or have ads that are not optimized for tablets.
Permissions
Snap will remove the following permissions from your integration
- android.permission.READ_PHONE_STATE
- android.permission.WRITE_EXTERNAL_STORAGE
- android.permission.READ_EXTERNAL_STORAGE
If you declare these permissions you will need to override Snaps' override
This is how you can do it:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="merge" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="merge" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
tools:node="merge" />
Snap Activity
Snap Activity does not have its own style but it does require one. Depending on how you declare the style of your application, Snap may inherit it. However, to avoid compilation issues we recommend declaring Snap's activities with a dedicated style:
<activity android:name="com.snap.adkit.external.InterstitialAdsActivity"
android:theme="@style/Theme.AppCompat.Light"/>
Note that it doesn't have to be this specific theme but it needs to be a theme declared by AppCompat.
Unity 3d and arm64 support
Warning
If you're using Unity 3d and you're building using Scripting Backend Mono (i.e., not targeting arm64 architectures), there might be a runtime exception on application start in devices with that cpu architecture.
You might see a stack trace like this:
java.lang.UnsatisfiedLinkError: No implementation found for void com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator() (tried Java_com_unity3d_player_UnityPlayer_nativeRestartActivityIndicator and Java_com_unity3d_player_UnityPlayer_nativeRestartActivityIndicator__)
at com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator(Native Method)
at com.unity3d.player.UnityPlayer.resume(Unknown Source:31)
at com.fyber.fairbid.unity.testapp.debug.UnityPlayerActivity.onResume(UnityPlayerActivity.java:57)
We recommend making sure you have the following code to your gradle template:
defaultConfig {
ndk {
abiFilters **ABIFILTERS**
}
}
The exception takes place because Unity tries to access native interfaces at runtime that aren't there.
This is a side-effect of a combination of:
- Android builds including support for all non-deprecated ABIs (Application Binary Interface) by default (starting on Unity 2018.4 the behavior is overridden and prevented)
- Unity only supporting arm64 when using Scripting Backend IL2CPP and explicitly declaring arm64 as a target architecture
- Snap SDK including some JNI (Java Native Interfaces) that will lead the JIT (just in time compiler) to optimize code for arm64, at runtime on arm64 devices, when full support for arm64 is not present.
The suggested solution is excluding any support for arm64 that might mislead Unity at runtime.
Note that arm64 devices still support armeabi-v7a ABI.
You can read more information about ABIs here