androidfirebaseadmobchartboostmobile-ad-mediation

How do i use Chartboost with admob mediation?


I am looking to use chartboost,vungle and adcolony with admob mediation.

I have successfully generated ads through vungle and adcolony.But not getting ads with chardboost.

        vunglePub.init(getActivity(), "String");



        AdColony.configure(getActivity(), "version", "String", "String");


        MobileAds.initialize(getActivity(), "String");
        mAd = MobileAds.getRewardedVideoAdInstance(getActivity());
        FromRewardVideos();
        Bundle bundle = new Bundle();


        adRequest = new AdRequest.Builder()
            .addNetworkExtrasBundle(VungleInterstitialAdapter.class, bundle)
            .addNetworkExtrasBundle(AdColonyAdapter.class, bundle)
            .addTestDevice("device_id")
            .build();

And i am trying to implement ChartBoost like this -

Chartboost.startWithAppId(getActivity(),"id","signature");
    DelegateMethod();
    Chartboost.setDelegate(chartboostDelegate);
    Chartboost.onCreate(getActivity());



private void AdLoad() {
    if (Chartboost.hasRewardedVideo(CBLocation.LOCATION_DEFAULT)) {
       Chartboost.showRewardedVideo(CBLocation.LOCATION_DEFAULT);
    }
    else {
        // We don't have a cached video right now, but try to get one for next time
        Chartboost.cacheRewardedVideo(CBLocation.LOCATION_DEFAULT);

    }
}

private void DelegateMethod() {
    chartboostDelegate = new ChartboostDelegate() {
        @Override
        public void didFailToLoadRewardedVideo(String location, CBError.CBImpressionError error) {
            super.didFailToLoadRewardedVideo(location, error);

            Chartboost.cacheRewardedVideo(CBLocation.LOCATION_DEFAULT);



        }

    };
}

And calling adbuilder like this

Bundle bundle = new Bundle();


    adRequest = new AdRequest.Builder()
        .addNetworkExtrasBundle(ChartboostAdapter.class, bundle)
        .addTestDevice("device_id")
        .build();

Thanks in advance


Solution

  • If you're trying to mediate all of these networks through AdColony, I believe you are NOT supposed to be initializing all of the ad networks on their own. The AdMob adapter functions by initializing each ad network as you call for an ad.

    I know that for Chartboost in particular, if you initialize the SDK outside of the Chartboost adapter, the AdMob integration with Chartboost will simply fail and you're better off using Chartboost on its own. AdMob intends to have the adapter do all of the initializing.

    I believe they have official instructions on how to integrate each ad network at this link here: https://firebase.google.com/docs/admob/ios/mediation-networks