Snap

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 via FairBid Mediation.

This is a six-step process:

  1. Create or login to your Snap Account
  2. Create an app in Snap
  3. Create a placement for your app
  4. Retrieve the parameters from the Snap dashboard
  5. Insert the Snap parameters into the Fyber Console
  6. Add the Snap SDK to your integration

Note

Snap currently supports the following ad formats:

  • 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 create your Snap account.

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

Click here and follow the instructions to create a placement for your app.

Step 4: Retrieve the Parameters from the Snap Dashboard

To enable Snap to work as an Ad Network on the FairBid Mediation platform, you must obtain five 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 parameters required 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 with Snap. Both
Refresh Token The refresh token the client application already received Both
Account ID The identifier of the account associated with Snap 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 Organization ID, Client ID, Client Secret and Refresh Token:

  1. From the Fyber Console, select Snap Audience Network as the mediated network:

    Screen_Shot_2021-01-06_at_12.02.46.png

  2. Click Sign In with Snap

    Screen_Shot_2021-01-06_at_12.04.05.png

  3. Sign in to your Snap account with your User Name and Password.
  4. The credentials are automatically completed in the window

    Screen_Shot_2021-01-06_at_11.58.20.png

Now that you have obtained the required parameters, you can complete the configuration of Snap in your Fyber Account. 

Step 5: Insert the Snap parameters into the Fyber Console

To enter the parameters obtained from Snap and insert them into the Fyber Console, follow these steps.

  1. Sign-in to your Fyber account.
  2. Select your app from the App Management window.

  1. On the App Management page, click Mediated Networks.

  1. Select Snap from the list

Screen_Shot_2021-01-04_at_13.56.34.png

The Snap configuration window opens and the credentials are already entered:

Screen_Shot_2021-01-06_at_11.58.20.png

Instance name should be distinguishable in case you have multiple Snap Instances.

Note

If you are configuring the mediated network at app level, fewer credentials may be required.

  1. Click Save.
  2. To complete the set up, 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 6: 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.

 

iOS

Tablets

Snap does not officially support tablets. Snap will fail to initialize.

Android

There are some additional notes regarding Snap 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's 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 potentially 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 which 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 behaviour 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