Documentation

Unity Ads Monetization


Android API reference

Unity Ads Monetization


Android deprecated APIs

Identify deprecated Unity Ads SDK classes for Android, as well as the replacement and removal versions.
Read time 4 minutesLast updated a day ago

Android deprecated classes

The following API classes are deprecated or obsolete for the Android SDK for the Unity Ads SDK version 4.19.0.

Initialization

API to be removed

Deprecated in version

What to use instead

Removed in version

Deprecation reason

UnityAds.initialize(context, gameId, isTesting, IUnityAdsInitializationListener)
4.19.0
UnityAds.initialize(InitializationConfiguration, InitializationListener)
built via
InitializationConfiguration.Builder(gameId)
5.0.0Replaced by a builder-based configuration API with a unified single-method listener. Mediation info is now passed at initialization time via the builder.
IUnityAdsInitializationListener
interface (
onInitializationComplete()
/
onInitializationFailed(UnityAdsInitializationError, String)
)
4.19.0
InitializationListener
with a single
onInitializationComplete(@Nullable UnityAdsError)
null
means success
5.0.0Two-method delegate replaced by a single nullable-error callback, consistent with the unified
UnityAdsError
model.
MediationMetaData
class
4.19.0
MediationInfo
— constructed as
new MediationInfo(name, sdkVersion, adapterVersion)
and passed via
.withMediationInfo()
on each builder
5.0.0Mutable key-value metadata object replaced by an immutable typed value object passed directly into the builder API.
MetaData
class (used for privacy and mediation key-value pairs)
4.19.0Use
MediationInfo
for mediation data; use
UnityAds.setUserConsent()
,
setUserOptOut()
, and
setNonBehavioral()
for privacy
5.0.0Generic string key-value metadata replaced by typed, purpose-specific APIs.
UnityAds.UnityAdsInitializationError
enum
4.19.0Unified
UnityAdsError
— use
error.getCode()
(int) and
error.getMessage()
(String)
5.0.0Per-operation error enums replaced by a unified error type with standardized numeric codes across all operations.

Interstitial ads

API to be removed

Deprecated in version

What to use instead

Removed in version

Deprecation reason

UnityAds.load(placementId, UnityAdsLoadOptions, IUnityAdsLoadListener)
4.19.0
InterstitialAd.load(LoadConfiguration, LoadListener<InterstitialAd>)
built via
LoadConfiguration.Builder(placementId)
5.0.0Static generic load replaced by a type-specific instance-based load API.
IUnityAdsLoadListener
interface (
onUnityAdsAdLoaded
/
onUnityAdsFailedToLoad
)
4.19.0
LoadListener<InterstitialAd>
with a single
onAdLoaded(@Nullable InterstitialAd, @Nullable UnityAdsError)
5.0.0Two-method listener replaced by a single nullable-error callback that also delivers the typed ad instance.
UnityAdsLoadOptions
4.19.0
LoadConfiguration.Builder(placementId)
with
.withMediationInfo()
and
.withAdMarkup()
5.0.0Mutable options object replaced by an immutable builder-pattern configuration.
UnityAdsLoadOptions.setObjectId(UUID)
4.19.0No replacement — object ID is now managed internally by the SDK5.0.0Manual correlation IDs are no longer required; the SDK handles ad instance tracking internally.
UnityAds.show(activity, placementId, UnityAdsShowOptions, IUnityAdsShowListener)
4.19.0
interstitialAd.show(activity, ShowConfiguration, InterstitialShowListener)
called on the retained
InterstitialAd
instance
5.0.0Static show on the global class replaced by an instance method on the loaded ad object.
IUnityAdsShowListener
interface (interstitial) —
onUnityAdsShowStart
,
onUnityAdsShowClick
,
onUnityAdsShowComplete
,
onUnityAdsShowFailure
4.19.0
InterstitialShowListener
onStarted(InterstitialAd)
,
onClicked(InterstitialAd)
,
onCompleted(InterstitialAd, ShowFinishState)
,
onFailed(InterstitialAd, UnityAdsError)
5.0.0String-keyed, generic show listener replaced by a typed ad-specific listener. Callbacks receive the ad instance rather than a placement ID string.
UnityAdsShowOptions
4.19.0
ShowConfiguration.Builder().build()
5.0.0Mutable options object replaced by an immutable builder-pattern show configuration.
UnityAdsShowOptions.setObjectId()
4.19.0No replacement — object ID is managed internally5.0.0Manual correlation IDs are no longer required.
UnityAds.UnityAdsLoadError
enum
4.19.0Unified
UnityAdsError
with
getCode()
and
getMessage()
5.0.0Per-operation error enum replaced by the unified error type.
UnityAds.UnityAdsShowError
enum
4.19.0Unified
UnityAdsError
with
getCode()
and
getMessage()
5.0.0Per-operation error enum replaced by the unified error type.

Rewarded ads

API to be removed

Deprecated in version

What to use instead

Removed in version

Deprecation reason

UnityAds.load(placementId, UnityAdsLoadOptions, IUnityAdsLoadListener)
4.19.0
RewardedAd.load(LoadConfiguration, LoadListener<RewardedAd>)
built via
LoadConfiguration.Builder(placementId)
5.0.0Static generic load replaced by a type-specific instance-based load API.
IUnityAdsLoadListener
interface
4.19.0
LoadListener<RewardedAd>
with a single
onAdLoaded(@Nullable RewardedAd, @Nullable UnityAdsError)
5.0.0Two-method listener replaced by a single nullable-error callback that delivers the typed ad instance.
UnityAds.show(activity, placementId, UnityAdsShowOptions, IUnityAdsShowListener)
4.19.0
rewardedAd.show(activity, ShowConfiguration, RewardedShowListener)
called on the retained
RewardedAd
instance
5.0.0Static show on the global class replaced by an instance method on the loaded ad object.
IUnityAdsShowListener
interface — reward determined by checking
UnityAdsShowCompletionState.COMPLETED
inside
onUnityAdsShowComplete
4.19.0
RewardedShowListener
with a dedicated
onRewarded(RewardedAd)
callback, plus
onStarted
,
onClicked
,
onCompleted(RewardedAd, ShowFinishState)
,
onFailed(RewardedAd, UnityAdsError)
5.0.0Checking completion state for reward eligibility replaced by a dedicated reward callback. Note:
onCompleted
still fires after
onRewarded
.
UnityAds.UnityAdsShowCompletionState
enum (
COMPLETED
,
SKIPPED
)
4.19.0
ShowFinishState
enum; reward logic moved to
RewardedShowListener.onRewarded()
5.0.0Enum renamed for consistency; reward grant logic should use the dedicated
onRewarded
callback rather than inspecting completion state.

API to be removed

Deprecated in version

What to use instead

Removed in version

Deprecation reason

BannerView
class (
com.unity3d.services.banners
)
4.19.0
BannerAd
class (
com.unity3d.ads
) — the Android
View
is retrieved via
ad.getView()
5.0.0Direct view class replaced by an ad instance object whose view is accessed via a getter, consistent with the new ad object model.
BannerView.IListener
interface —
onBannerLoaded
,
onBannerFailedToLoad
,
onBannerShown
,
onBannerClick
,
onBannerLeftApplication
4.19.0Two separate listeners:
LoadListener<BannerAd>
for load result (
onAdLoaded
);
BannerShowListener
for impression (
onImpression
), click (
onClicked
), and show failure (
onFailedToShow
)
5.0.0Single combined listener split into distinct load and show listeners.
onBannerLeftApplication
is removed with no replacement.
BannerView.load(UnityAdsLoadOptions)
4.19.0
BannerAd.load(BannerConfiguration, LoadListener<BannerAd>)
built via
BannerConfiguration.Builder(placementId, BannerSize, BannerShowListener)
5.0.0Constructor + separate load method replaced by a unified static load with a builder configuration, consistent with interstitial and rewarded.
UnityBannerSize
class
4.19.0
BannerSize
class — also supports adaptive sizing (anchored and inline)
5.0.0Renamed for namespace consistency; the new class also adds adaptive banner size support.
BannerErrorCode
/
BannerErrorInfo
4.19.0Unified
UnityAdsError
with
getCode()
and
getMessage()
5.0.0Banner-specific error types replaced by the unified error type used across all ad formats.
onBannerLeftApplication
callback on
BannerView.IListener
4.19.0No replacement5.0.0Callback removed with no equivalent in the new
BannerShowListener
.

Privacy

API to be removed

Deprecated in version

What to use instead

Removed in version

Deprecation reason

MetaData
with key
"gdpr.consent"
4.19.0
UnityAds.setUserConsent(boolean)
5.0.0String key-value privacy metadata replaced by a typed static method.
context
is no longer required.
MetaData
with key
"privacy.consent"
(CCPA)
4.19.0
UnityAds.setUserOptOut(boolean)
— pass
true
when the user has opted out (Do not sell)
5.0.0String key-value privacy metadata replaced by a typed static method with explicit opt-out semantics.
MetaData
with key
"user.nonBehavioral"
(COPPA, child-directed laws)
4.19.0
UnityAds.setNonBehavioral(false)
5.0.0Privacy mode string replaced by an explicit boolean API for non-behavioral/contextual ad control.

Error handling

API to be removed

Deprecated in version

What to use instead

Removed in version

Deprecation reason

UnityAds.UnityAdsLoadError
enum (
NO_FILL
,
INTERNAL_ERROR
,
INVALID_ARGUMENT
,
TIMEOUT
,
INITIALIZE_FAILED
)
4.19.0Unified
UnityAdsError
— use
error.getCode()
(int) and
error.getMessage()
(String). Code 52100 = no fill; 52101 = not initialized; 52102/52104 = invalid configuration; 2 = timeout.
5.0.0Per-operation load error enum replaced by a unified error type with standardized numeric codes.
UnityAds.UnityAdsShowError
enum (
NOT_INITIALIZED
,
NOT_READY
,
VIDEO_PLAYER_ERROR
,
INVALID_ARGUMENT
,
NO_CONNECTION
,
ALREADY_SHOWING
,
INTERNAL_ERROR
)
4.19.0Unified
UnityAdsError
with
getCode()
and
getMessage()
5.0.0Per-operation show error enum replaced by a unified error type with standardized numeric codes.
BannerErrorCode
enum /
BannerErrorInfo
class
4.19.0Unified
UnityAdsError
with
getCode()
and
getMessage()
5.0.0Banner-specific error type replaced by the same unified error used across all ad formats.