Search in sources :

Example 1 with MediationMetaData

use of com.unity3d.ads.metadata.MediationMetaData in project mopub-android-mediation by mopub.

the class UnityRouter method initUnityAds.

static boolean initUnityAds(Map<String, String> serverExtras, Activity launcherActivity) {
    String gameId = serverExtras.get(GAME_ID_KEY);
    if (gameId == null || gameId.isEmpty()) {
        MoPubLog.e("gameId is missing or entered incorrectly in the MoPub UI");
        return false;
    }
    MediationMetaData mediationMetaData = new MediationMetaData(launcherActivity);
    mediationMetaData.setName("MoPub");
    mediationMetaData.setVersion(MoPub.SDK_VERSION);
    mediationMetaData.commit();
    UnityAds.initialize(launcherActivity, gameId, sUnityAdsListener);
    return true;
}
Also used : MediationMetaData(com.unity3d.ads.metadata.MediationMetaData)

Example 2 with MediationMetaData

use of com.unity3d.ads.metadata.MediationMetaData in project mopub-android-mediation by mopub.

the class UnityVideoAd method show.

@Override
public void show() {
    MoPubLog.log(SHOW_ATTEMPTED, ADAPTER_NAME);
    MediationMetaData mediationMetaData = new MediationMetaData(mActivity);
    if (mActivity == null || mPlacementId == null) {
        if (mActivity == null) {
            MoPubLog.log(CUSTOM, ADAPTER_NAME, LOG_SHOW_ACTIVITY_NULL.getMessage());
        }
        if (!TextUtils.isEmpty(mPlacementId)) {
            MoPubLog.log(CUSTOM, ADAPTER_NAME, LOG_PLACEMENT_ID_MISSING.getMessage());
        }
        MoPubLog.log(SHOW_FAILED, ADAPTER_NAME, MoPubErrorCode.VIDEO_PLAYBACK_ERROR.getIntCode(), MoPubErrorCode.VIDEO_PLAYBACK_ERROR);
        mediationMetaData.setMissedImpressionOrdinal(++missedImpressionOrdinal);
        mediationMetaData.commit();
        UnityEventAdapter.sendAdPlaybackEvent(mInteractionListener, AdEvent.SHOW_FAILED, MoPubErrorCode.VIDEO_PLAYBACK_ERROR);
        return;
    }
    mediationMetaData.setOrdinal(++impressionOrdinal);
    mediationMetaData.commit();
    final UnityAdsShowOptions showOptions = new UnityAdsShowOptions();
    if (mObjectId != null) {
        showOptions.setObjectId(mObjectId);
    }
    UnityAds.show(mActivity, mPlacementId, showOptions, getIUnityAdsShowListener());
}
Also used : MediationMetaData(com.unity3d.ads.metadata.MediationMetaData) UnityAdsShowOptions(com.unity3d.ads.UnityAdsShowOptions)

Example 3 with MediationMetaData

use of com.unity3d.ads.metadata.MediationMetaData in project mopub-android-mediation by mopub.

the class UnityAdsInitializer method initMediationMetadata.

private void initMediationMetadata(Context context) {
    final MediationMetaData mediationMetaData = new MediationMetaData(context);
    mediationMetaData.setName("MoPub");
    mediationMetaData.setVersion(MoPub.SDK_VERSION);
    mediationMetaData.set("adapter_version", ADAPTER_VERSION);
    mediationMetaData.commit();
}
Also used : MediationMetaData(com.unity3d.ads.metadata.MediationMetaData)

Aggregations

MediationMetaData (com.unity3d.ads.metadata.MediationMetaData)3 UnityAdsShowOptions (com.unity3d.ads.UnityAdsShowOptions)1