Admob for iOS MOE

Hi,

Does anyone manage to get adMob to work in iOS-MOE? I can’t find any information on this question. Appreciate if anyone out there could provide a useful info.

Thanks,
le

1 Like

Yes, I got it working, but maybe it is not possible to publish the app to iTunes connect due to ipv6 problems. Anyway, here is the snippet:

private IOSApplication gdxApp;

@Override
protected IOSApplication createApplication() {
    IOSApplicationConfiguration config = new IOSApplicationConfiguration();
    config.useAccelerometer = false;
    gdxApp =  new IOSApplication(new MyGame(), config);
    return gdxApp;
}

@Override
public void applicationDidBecomeActive(UIApplication application) {
    GADMobileAds.configureWithApplicationID("myID");

    adView = GADBannerView.alloc().initWithAdSize(GoogleMobileAds.kGADAdSizeBanner());
    adView.setAdUnitID(Constants.AD_BANNER_BLOCK_ID);

    CGRect cgRect = new CGRect();
    cgRect.setSize(GoogleMobileAds.kGADAdSizeBanner().size());

    adView.setFrame(cgRect);
    adView.setRootViewController(uiViewController);

    GADRequest request = GADRequest.request();

    request.setTestDevices(NSArray.arrayWithObject(GoogleMobileAds.kGADSimulatorID()));

    adView.loadRequest(request);

    adView.setCenter( new CGPoint(UIScreen.mainScreen().bounds().size().width() * 0.5f, 20));

    gdxApp.getUIWindow().addSubview(adView);
}
1 Like

Thanks Reime, I will give it a try.

Hi Reime,

Any clue if I want the banner to display at the bottom but without covering the application view i.e. application view scale smaller a little bit on top of the banner view.

I’ve tried the gdxApp.getUIWindow().setFrame(new CGRect(new CGPoint(0, 0), new CGSize(screenWidth, screenHeight - bannerAdsHeight)) and gdxApp.getUIWindow().setAutoresizesSubviews(true) but not working. The bottom part of the application view is showing but the top part is hidden above the screen top. Not sure why such strange behaviour.

Any suggestion is welcomed. Thanks in advance.

Sorry, I have not worked with that for two years, so I can’t help you