Java 类com.google.android.gms.ads.reward.mediation.MediationRewardedVideoAdAdapter 实例源码

项目:googleads-mobile-android-mediation    文件:MaioEventForwarder.java   
private void _showVideo(String zoneId,
                        MediationRewardedVideoAdAdapter adapter,
                        MediationRewardedVideoAdListener listener) {
    MaioAds.show(zoneId);
    this.mRewardedAdapter = adapter;
    this.mMediationRewardedVideoAdListener = listener;
    mAdType = AdType.VIDEO;
}
项目:mytarget-android    文件:MyTargetAdmobCustomEventRewarded.java   
@Override
public void initialize(Context context,
                       MediationAdRequest mediationAdRequest,
                       String serverJSON,
                       MediationRewardedVideoAdListener mediationRewardedVideoAdListener,
                       Bundle serverParameters,
                       Bundle mediationExtras)
{
    this.mediationRewardedVideoAdListener = mediationRewardedVideoAdListener;

    int slotId;
    try
    {
        String adUnit = serverParameters.getString(
                MediationRewardedVideoAdAdapter.CUSTOM_EVENT_SERVER_PARAMETER_FIELD);
        JSONObject param = new JSONObject(adUnit);
        slotId = param.getInt(SLOT_ID_KEY);
    } catch (JSONException e)
    {
        Log.i(TAG,
              "Unable to get slotId from parameter json. Probably Admob mediation " +
                      "misconfiguration.");
        mediationRewardedVideoAdListener.onAdFailedToLoad(
                com.my.target.ads.mediation.MyTargetAdmobCustomEventRewarded.this,
                AdRequest.ERROR_CODE_INTERNAL_ERROR);
        return;
    }

    interstitial = new InterstitialAd(slotId, context);
    interstitial.getCustomParams().setCustomParam("mediation", "1");

    if (mediationAdRequest != null)
    {
        interstitial.getCustomParams().setGender(mediationAdRequest.getGender());
        Date date = mediationAdRequest.getBirthday();
        if (date != null && date.getTime() != -1)
        {
            GregorianCalendar calendar = new GregorianCalendar();
            GregorianCalendar calendarNow = new GregorianCalendar();

            calendar.setTimeInMillis(date.getTime());
            int a = calendarNow.get(GregorianCalendar.YEAR) -
                    calendar.get(GregorianCalendar.YEAR);
            if (a >= 0)
            {
                interstitial.getCustomParams().setAge(a);
            }
        }
    }

    interstitial.setListener(interstitialAdListener);
    mediationRewardedVideoAdListener
            .onInitializationSucceeded(com.my.target.ads.mediation.MyTargetAdmobCustomEventRewarded.this);
}
项目:googleads-mobile-android-mediation    文件:MaioEventForwarder.java   
public static void showVideo(String zoneId,
                             MediationRewardedVideoAdAdapter adapter,
                             MediationRewardedVideoAdListener listener) {
    sInstance._showVideo(zoneId, adapter, listener);
}