HyprMX Mobile SDK MoPub (Unity) Adapter Overview

Introduction

The HyprMX Unity MoPub Adapter allows you to integrate HyprMX in your MoPub rewarded and interstitial waterfalls.

  • Android and iOS: Compatible with MoPub 5.13.1+

The HyprMX Unity Plugin requires CocoaPods version 1.9.3 or newer installed in your development environment.

Integrating HyprMX In Your Unity Project

  • Download the Adapter Plugin file below.

  • Open your existing application in the Unity IDE.

  • Choose Assets > Import Package > Custom Package... to bring up the File Explorer (Windows) or Finder (Mac).

  • Select the HyprMX Unity MoPub Adapter package, and the Import Unity Package dialog box displays, with all the items in the package pre-checked and ready to install.

  • Android: If the External Dependency Resolver did not automatically resolve the HyprMX dependencies upon import, select Assets > External Dependency Manager > Android Resolver > Resolve.

  • iOS: If the External Dependency Resolver did not automatically resolve the HyprMX dependencies upon import, select Assets > External Dependency Manager > iOS Resolver > Install Cocoapods.

Pre-Initialization

Add the following to your SdkConfiguration before you initialize MoPub with the configuration object. See Initialize Custom Ad Networks in the MoPub documentation.

MoPub.InitializeSdk(new MoPub.SdkConfiguration {
AdUnitId = anyAdUnitId,
// Set desired log level here to override default level of MPLogLevelNone
LogLevel = MoPub.LogLevel.Debug,
// Uncomment the following line to allow supported SDK networks to collect user information on the basis
// of legitimate interest.
//AllowLegitimateInterest = true,
// Specify the mediated networks you are using here:
MediatedNetworks = new MoPub.MediatedNetwork[]{
new MoPub.MediatedNetwork {
// Specify the class name that implements the AdapterConfiguration interface.
#if UNITY_ANDROID
AdapterConfigurationClassName = "com.mopub.mobileads.HyprMXAdapterConfiguration", // include the full package name.
#else // UNITY_IOS
AdapterConfigurationClassName = "HyprMXAdapterConfiguration",
#endif
// Fill in settings and configuration options the same way as for supported networks:
NetworkConfiguration = new Dictionary {
{ "distributorId", "YOUR_DISTRIBUTOR_ID" },
{ "userId", "YOUR_USER_ID" }, // Optional key-value pair
},
}
}
});

If you do not want to include a User ID, initialize the MoPub.MediatedNetwork without the "userId" key-value pair:

new MoPub.MediatedNetwork {
// Specify the class name that implements the AdapterConfiguration interface.
#if UNITY_ANDROID
AdapterConfigurationClassName = "com.mopub.mobileads.HyprMXAdapterConfiguration", // include the full package name.
#else // UNITY_IOS
AdapterConfigurationClassName = "HyprMXAdapterConfiguration",
#endif
// Fill in settings and configuration options the same way as for supported networks:
NetworkConfiguration = new Dictionary<string,string> {
{ "distributorId", "YOUR_DISTRIBUTOR_ID" },
},
}

Integrating HyprMX On The MoPub Dashboard Using Custom Events

1. Create a custom native network campaign in the MoPub dashboard.

2. When setting up your line item, select 'Network' for the 'Type' field and then select 'Custom Native Network' for the 'Network' field. Further instructions for adding a network account can be found here.

3. In the parameter field, enter the distributor ID and placement name assigned to you by your HyprMX account manager.{ "distributorID": "YOUR_DISTRIBUTOR_ID", "placementName": "YOUR_PLACEMENT_NAME"}

4. For Rewarded video, paste the following class name as the Custom Event class:

Android:

com.mopub.mobileads.HyprMXRewardedVideo

iOS:

HyprMXRewardedVideoCustomEvent

5. For Interstitial, paste the following class name as the Custom Event class:

Android:

com.mopub.mobileads.HyprMXInterstitial

iOS:

HyprMXInterstitialCustomEvent

Android Configuration

In order to maximize fill rates, we recommend adding the WRITE_EXTERNAL_STORAGE and VIBRATE permissions. To add the WRITE_EXTERNAL_STORAGE permission, open the player settings and select the External (SDCard) write permission:To add the WRITE_EXTERNAL_STORAGE permission, open the player settings and select the External (SDCard) write permission:

Open Player Settings
Select External (SDCard) from the Write Permission dropdown

To add the VIBRATE permission, add the following to your AndroidManifest.xml:

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

iOS Configuration

  • If you prefer to enable ATS, uncheck the "Allow Downloads over HTTP" checkbox in Player Settings.

  • When the checkbox is unchecked, add the following keys to the exported iOS project's Info.plist:

    • NSAllowsArbitraryLoads

    • NSAllowsArbitraryLoadsForMedia

    • NSAllowsArbitraryLoadsInWebContent

Configuring Privacy Controls

iOS requires that the use of a user's camera, calendar, photo library, idfa, etc. be declared by advertisers in the plist. Add all of the following entries to your app's plist.

<key>NSCameraUsageDescription</key>
<string>${PRODUCT_NAME} requests write access to the Camera</string>
<key>NSCalendarsUsageDescription</key>
<string>${PRODUCT_NAME} requests access to the Calendar</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>${PRODUCT_NAME} requests access to the Photo Library</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>${PRODUCT_NAME} requests write access to the Photo Library</string>
<key>NSUserTrackingUsageDescription</key>
<string>${PRODUCT_NAME} would like to show you personalized ads</string>

Note: Photo Usage and the Photo Add Usage keys are required by the framework to ensure all rich media advertisements are supported.

SKAdNetwork Identifier

The HyprMX 5.4.0+ SDK supports Apple's new SKAdNetwork for Attribution. To add the HyprMX SKAdNetwork ID to your info.plist:

<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>NU4557A4JE.skadnetwork</string>
</dict>
...
</array>

Note: SKAdNetwork Id's are case sensitive. For more information about SKAdNetwork please refer to Apple's documentation.

Deprecated: HyprMXGlobalMediationSettings (iOS)

Removed: HyprMXMediationSettings (Android)

HyprMXGlobalMediationSettings(iOS) has been deprecated and HyprMXMediationSettings(Android) has been removed in favor of pre-initialization. Please follow the pre-initialization steps above to pass in the user id.

License

By integrating the HyprMX SDK, you are agreeing to the End User License Agreement.