Migrate to Version 6.4+
Please follow the below guide to migrate from the HyprMX SDK 6.x to 6.4+.
This guide applies to partners upgrading to version 6.4+ from pre-6.4 versions. No migration is needed if you're upgrading from 6.4+.
HyprMX SDK 6.4+ contains a revamp to our public API, streamlining our SDK's initialization and providing more focused callbacks and listeners. Additionally, we now provide modernized asynchronous APIs that you can opt into.
SDK migration
If you're using Gradle to manage your dependencies, you just need to bump the SDK dependency version number. Check out our SDK integration section for more info.
To migrate the HyprMX SDK, update the HyprMX SDK version number to 6.4.2
in your app's build.gradle
file dependencies block:
Fixing Your Broken Build
See below for migrations related to HyprMX SDK 6.4+.
Migrating HyprMX.initialize
The new SDK initializer parameters only require distributorId
and vary slightly by result method. Following is a sample initializer for 6.4+ SDK:
Other parameters have new setters. As a result, you will need to migrate the following parameters:
consentStatus
ageRestrictedUser
userID
Follow the steps below to migrate the parameters.
Migrating the consentStatus
parameter
consentStatus
parameterMigrating the ageRestrictedUser
parameter
ageRestrictedUser
parameterMigrating the userId
parameter
userId
parameterOur API no longer accepts user ID. Please remove it from the new method signature.
Migrating HyprMxIf.HyprMXInitializationListener
The initializationListener
used by initialize
, a few code snippets above, is an instance of HyprMxIf.HyprMXInitializationListener
as it was in the HyprMX SDK 6.2 although its implementation changed.
The old initializationComplete
and initializationFailed
listeners were replaced with onInitialized
. The latest will callback with a boolean
flag to indicate whether the SDK was successfully initialized or not.
Migrating FullScreen Placement.loadAd
The new API doesn't require you to set a PlacementListener
to load an ad. In fact, this listener no longer exists. Note: You can read more about it while migrating the Placement.showAd
API.
To migrate existing code:
Remove the
Placement.setPlacementListener(PlacementListener)
Replace the old
Placement.loadAd
and migrate the code you had insidePlacementListener.onAdAvailable
andPlacementListener.onAdNotAvailable
to the new loadAd callback.
Migrating FullScreen Placement.showAd
The new Placement.showAd
API requires you to define a listener as an argument, HyprMXShowListener
. This listener will provide a set of useful callbacks you might need to manipulate the UI state. In fact, some of the PlacementListener
callbacks can now be migrated to the new HyprMXShowListener
.
Here is a short comparison between PlacementListener and HyprMXShowListener:
To migrate existing code:
Remove the
Placement.setPlacementListener(PlacementListener)
Replace the old
Placement.showAd
and set theHyprMXShowListener
instance as argument
If you're working with rewarded placements, use
HyprMXRewardedShowListener
. This specialized listener includes an extra callback to handle the reward logic:
Note that onAdExpired also disappeared. If you need a callback to onAdExpired then set
HyprMXPlacementExpiryListener
and call it on your placement usingsetPlacementExpiryListener
.
Migrating Banner Placement.loadAd
The new API uses both async and synchronous methods to load a banner ad. To migrate existing code:
Remove the callback methods onAdLoaded and loadAdFailure.
Replace the old
Placement.loadAd
and migrate the code you had insidePlacementListener.onAdAvailable
andPlacementListener.onAdNotAvailable
to the new loadAd callback.
Migrating HyprMXBannerView
The new API uses both async and synchronous methods to load a banner ad. To migrate existing code:
Remove the callback methods onAdLoaded and onAdFailedToLoad from your
HyprMXBannerListener
listener implementation.Replace the old
hyprMXBannerView.loadAd()
with either one of the following new methods:
Migration complete.
Last updated