Source:
public void load(MediationRewardedAdConfiguration mediationRewardedAdConfiguration, MediationAdLoadCallback<MediationRewardedAd, MediationRewardedAdCallback> callback) { this.mMediationAdLoadCallback = callback; Context context = mediationRewardedAdConfiguration.getContext(); if (context == null || !(context instanceof Activity)) { if (mMediationAdLoadCallback != null) { mMediationAdLoadCallback.onFailure("Context is null or is not an Activity." + " Unity Ads requires an Activity context to show ads."); } return; } Bundle serverParameters = mediationRewardedAdConfiguration.getServerParameters(); final String gameId = serverParameters.getString(UnityMediationAdapter.KEY_GAME_ID); mPlacementId = serverParameters.getString(UnityMediationAdapter.KEY_PLACEMENT_ID); if (!UnityAdapter.isValidIds(gameId, getPlacementId())) { if (mMediationAdLoadCallback != null) { mMediationAdLoadCallback.onFailure("Failed to load rewarded ad from Unity Ads: " + "Missing or invalid game ID and placement ID."); } return; } UnityInitializer.getInstance().initializeUnityAds(context, gameId, new IUnityAdsInitializationListener() { @Override public void onInitializationComplete() { Log.d(UnityAdapter.TAG, "Unity Ads successfully initialized, can now " + "load rewarded ad for placement ID '" + getPlacementId() + "' in game " + "'" + gameId + "'."); loadRewardedAd(getPlacementId()); } @Override public void onInitializationFailed(UnityAds.UnityAdsInitializationError unityAdsInitializationError, String s) { Log.e(UnityAdapter.TAG, "Unity Ads initialization failed: [" + unityAdsInitializationError + "] " + s + ", cannot load rewarded ad " + "for placement ID '" + getPlacementId() + "' in game '" + gameId + "'"); if (mMediationAdLoadCallback != null) { mMediationAdLoadCallback.onFailure("Failed to load rewarded ad from Unity Ads."); } } }); }

Target:
public void load(MediationRewardedAdConfiguration mediationRewardedAdConfiguration, MediationAdLoadCallback<MediationRewardedAd, MediationRewardedAdCallback> callback) { this.mMediationAdLoadCallback = callback; Context context = mediationRewardedAdConfiguration.getContext(); if (context == null || !(context instanceof Activity)) { if (mMediationAdLoadCallback == null) { return; } mMediationAdLoadCallback.onFailure("Context is null or is not an Activity." + " Unity Ads requires an Activity context to show ads."); return; } Bundle serverParameters = mediationRewardedAdConfiguration.getServerParameters(); final String gameId = serverParameters.getString(UnityMediationAdapter.KEY_GAME_ID); mPlacementId = serverParameters.getString(UnityMediationAdapter.KEY_PLACEMENT_ID); if (!UnityAdapter.isValidIds(gameId, mPlacementId)) { if (mMediationAdLoadCallback == null) { return; } mMediationAdLoadCallback.onFailure("Failed to load rewarded ad from Unity Ads: " + "Missing or invalid game ID and placement ID."); return; } UnityInitializer.getInstance().initializeUnityAds(context, gameId, new IUnityAdsInitializationListener() { @Override public void onInitializationComplete() { Log.d(UnityAdapter.TAG, "Unity Ads successfully initialized, can now " + "load rewarded ad for placement ID '" + mPlacementId + "' in game " + "'" + gameId + "'."); UnityAds.addListener(UnityRewardedAd.this); UnityAds.load(mPlacementId, mUnityLoadListener); } @Override public void onInitializationFailed(UnityAds.UnityAdsInitializationError unityAdsInitializationError, String errorMessage) { UnityAds.removeListener(UnityRewardedAd.this); Log.e(UnityAdapter.TAG, "Unity Ads initialization failed: [" + unityAdsInitializationError + "] " + errorMessage + ", cannot load rewarded ad " + "for placement ID '" + mPlacementId + "' in game '" + gameId + "'"); if (mMediationAdLoadCallback != null) { mMediationAdLoadCallback.onFailure("Failed to load rewarded ad from Unity Ads."); } } }); }