1

I have recently implemented Chartboost into my libgdx project using this guide

https://github.com/itsabhiaryan/AdService-LibGDX

The guide clearly states that Chartboost does not support banner ads. This has changed recently with the Chartboost SDK 8.01. I have since tried to implement banner ads by adding the relevant code found here

https://answers.chartboost.com/en-us/child_article/using-banners-with-android-8-x

I have successfully played the ads (I tested this by using booleans that checked whether the ad was loaded and/or playing). However, my problem is that the ads seem to play in the background. It seems to be a problem with my layout. I display my interstitial and reward ads by using this code (these ads work fine)

RelativeLayout layout = new RelativeLayout(this);
View gameView = initializeForView(new MyGame(this), config);

layout.addView(gameView, ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);

ad.embedView(layout);

setContentView(layout);

Supposedly the Chartboost banner ads are View subclasses (meaning I can just add them to my layout?). I treated it as a View, but the ads never display.

I have tried this in my Android Launcher

RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
adParams.addRule(CENTER_HORIZONTAL);

chartboostBanner = new ChartboostBanner(this, CBLocation.LOCATION_DEFAULT, BannerSize.STANDARD, null);
layout.addView(chartboostBanner, adParams);

I have also tried this in the embedView method in ChartboostHelper

RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(CENTER_HORIZONTAL);
layout.addView(chartboostBanner, adParams);
chartboostBanner.bringToFront();

Both result in the ads playing but never displaying on screen.
Is there a guide on how to implement Chartboost banner ads in an Android Libgdx game? I have not been able to find anything after several days of google searches.

0 Answers0