Home Features Docs Blog Support GitHub

Libgdx: Adding third party binding (google / facebook) etc


(Rob Seeds) #1

Hi,
I have an app working on android but when I try to port it to iOS it’s creating some issues:
Third party lib: google-mobile-ads-sdk
In the andorid studio it’s not able to fo find the declarations for google-mobile-ads specific code (given below).
I am trying to use already built bindings from : https://multi-os-engine.org/blog/2017-03-16-moe-1.3.0-released/
but not sure how to '_

Then you just need to add it as a regular Maven dependency in your MOE app.

_’

private void init_admob_banner(){

GADBannerView adview = GADBannerView.alloc().initWithAdSize(GoogleMobileAds.kGADAdSizeMediumRectangle());
adview.setRootViewController(application.getUIViewController());
adview.setAdUnitID(“ca-app-pub-3940256099942544/2934735716”);
adview.setDelegate(new GADBannerViewDelegate() {
@Override
public void adViewDidReceiveAd(GADBannerView gadBannerView) {
adview.setHidden(false);

}
});

adview.setFrame(new CGRect(new CGPoint(0 + (320) / 2f - adview.bounds().size().width() / 2f, 0 + (680) / 2f - adview.bounds().size().height() / 2f), new CGSize(adview.bounds().size().width(), adview.bounds().size().height())));
GADRequest request = GADRequest.request();
NSMutableArray<String> devices = (NSMutableArray<String>) NSMutableArray.alloc().init();
devices.add(“D50DB872-AB44-4324-9C32-DAC5D9356F0B”);
request.setTestDevices(devices);
adview.loadRequest(request);
application.getUIViewController().view().addSubview(adview);

}

@Override
public void applicationDidBecomeActive(UIApplication application) {
super.applicationDidBecomeActive(application);

init_admob_banner();
}


(Raphael) #2

What exactly is the problem? What declarations aren’t found? Did you try creating the bindings yourself?