Do I need to add Chartboost code if I only use AdMob mediation to access their ads?

207 views
Skip to first unread message

Zol Heyman

unread,
Sep 1, 2016, 1:06:19 PM9/1/16
to Google Mobile Ads SDK Developers
If I'm only accessing Chartboost ads with AdMob mediation, do I need to add any Chartboost code (e.g. startWithAppId() and Activity lifecycle method code) to my Activity? Or do I only need to include the chartboost.jar and supporting files in my lib folder in my .apk build.

Thanks,
Zol

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Sep 1, 2016, 2:31:47 PM9/1/16
to Google Mobile Ads SDK Developers
Hi Zol,

With Chartboost mediation, you only have to copy its SDK and adaptor into your project. Once you make the AdRequest, the Mobile Ads SDK would take care of the rest for you. The adaptor would act as a bridge between the two SDKs. So if you receive an ad from Chartboost, our SDK would load that adaptor, which in turn would request the mediation SDK to render the ad. 

You can use this sample app, which has most of the mediation adaptors and SDKs included.

Thanks,
Arjun Busani
Mobiel Ads SDK Team

Zol Heyman

unread,
Sep 3, 2016, 6:47:11 PM9/3/16
to Google Mobile Ads SDK Developers

According to the Chartboost folks (and my testing), for mediation to work correctly, you need to add their lifecycle overrides in the Activity where you're showing the ad as well as adding the adapter and sdk jars.

And you must use an Activity class in the InterstitialAd constructor. The Context object returned by the Application.getApplicationContext() call is enough for AdMob usage, but an Activity is required to get a Chartboost ad loaded using AdMob mediation.

Zol

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Sep 6, 2016, 10:26:18 AM9/6/16
to Google Mobile Ads SDK Developers
Hi Zol,

Were you not able to run the linked sample app with your Ad Unit ID? You need to declare Chartboosts activity in the manifest for the Mobile Ads SDK to be able to render ads from that network. This is included in the sample app and you can learn more through their documentation as well.

Thanks,
Arjun Busani
Mobile Ads SDK Team

Zol Heyman

unread,
Sep 6, 2016, 2:17:56 PM9/6/16
to google-adm...@googlegroups.com

Without adding Chartboost lifecycle overrides (Charboost.onStart(), Chartboost.onCreate(), etc.), I could not get AdMob mediation to load Chartboost ads. When I added the lifecycle overrides, the Chartboost ads loaded fine using AdMob mediation. I’m only using Static Interstitial ads, no video.

And the bug that was hardest to find was the 2nd thing I mentioned: Using the constructor “new InterstitialAd(Context)”, the Context object must be an Activity.  Using the Context object supplied by Application.getApplicationContext() is not sufficient to get Chartboost ads to load. It works ok for loading unmediated AdMob ads. I figured that out using a Chartboost sample app provided by one of their support staff.


--

---
You received this message because you are subscribed to a topic in the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/61oGkyIrQGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vu Chau (Mobile Ads SDK Team)

unread,
Sep 6, 2016, 4:55:16 PM9/6/16
to Google Mobile Ads SDK Developers
Hi Zol,

You are correct that you need to override the activity's lifecycles with Chartboost's own (as shown in Step 8 from their integration guide).  Good catch on that one!

For the Chartboost ad constructor, I think you might have to cast your Context object (which can be anything, be it an activity, or service, or application) to an activity (Activity activity = (Activity) context).  Or, try classname.this.getActivity().

Vu Chau
Mobile Ads SDK Team

On Tuesday, September 6, 2016 at 2:17:56 PM UTC-4, Zol Heyman wrote:

Without adding Chartboost lifecycle overrides (Charboost.onStart(), Chartboost.onCreate(), etc.), I could not get AdMob mediation to load Chartboost ads. When I added the lifecycle overrides, the Chartboost ads loaded fine using AdMob mediation. I’m only using Static Interstitial ads, no video.

And the bug that was hardest to find was the 2nd thing I mentioned: Using the constructor “new InterstitialAd(Context)”, the Context object must be an Activity.  Using the Context object supplied by Application.getApplicationContext() is not sufficient to get Chartboost ads to load. It works ok for loading unmediated AdMob ads. I figured that out using a Chartboost sample app provided by one of their support staff.

Paul Yip

unread,
Sep 26, 2016, 5:22:35 AM9/26/16
to Google Mobile Ads SDK Developers
HI Vu,

Do I need step 6 as well?

@Override
public void onCreate() {
    super.onCreate();
    Chartboost.startWithAppId(this, appId, appSignature);
    Chartboost.onCreate(this);
    }   
}


Paul
To post to this group, send email to google-adm...@googlegroups.com.

Vu Chau (Mobile Ads SDK Team)

unread,
Sep 26, 2016, 11:04:04 AM9/26/16
to Google Mobile Ads SDK Developers
Hi Paul,

Yes, either that or you can extend ChartboostActivity where it says "pubic class ... extend Activity".

Vu Chau
Mobile Ads SDK Team

Zol Heyman

unread,
Sep 26, 2016, 12:03:18 PM9/26/16
to Google Mobile Ads SDK Developers
Hi Paul, I got the mediation to work without calling the Chartboost.startWithAppId() method. AdMob must call that internally in its mediation code, but I'm not sure when. 

I did need all of the lifecycle overrides plus the onBackPressed() override - if (Chartboost.onBackPressed() return;)

I also added the code below when I create the AdRequest. The Chartboost folks said it wasn't required but might be useful later when AdMob ads support for NamedLocations.
Bundle bundle = new ChartboostAdapter.ChartboostExtrasBundleBuilder()
.build();
builder.addNetworkExtrasBundle(ChartboostAdapter.class, bundle);

FYI: I'm only using static interstitial ads for now. I have not tested videos with mediation.

Zol

Vu Dang

unread,
Jul 11, 2017, 10:02:33 PM7/11/17
to Google Mobile Ads SDK Developers
Hi Zol,

I'm able to add all lifecycle events except for onCreate as my activity inherits from ReactActivity.  Do I need to override onCreate in order for it to load Chartboost ads?

Thank you,
Vu

Joshua Lagonera (Mobile Ads SDK Team)

unread,
Jul 12, 2017, 1:25:17 AM7/12/17
to Google Mobile Ads SDK Developers
Hi Vu,

While we are not able to comment about React, from our SDK's perspective, overriding the onCreate() method should not be a required step in mediating with Chartboost. You can check out our official guide on How to Mediate with Chartboost for Android on our official documentation site for more information.

Additionally, seeing as this thread is a bit old, please create a new thread if you want further assistance with any concern specific to the Mobile Ads SDK and we will be glad to assist you.

Regards,
Joshua Lagonera
Mobile Ads SDK Team
Reply all
Reply to author
Forward
0 new messages