LIBGDX ROBOVM admob IOS SDK Bindings

Source: Internet
Author: User
Tags libgdx admob

The main advertising platform in iOS is AdMob, which is in the framework of the latest admob, binding the project https://github.com/BlueRiverInteractive/ The Robovm-ios-bindings/tree/master/admob has not been used properly. See everyone has a demand, overtime to 1 o'clock in the morning, finally to get it done. There are some problems that can never be solved. Below to explain how to use.

1. The difficulties encountered,

Because there are several wonderful words in AdMob, you can't use hidden symbol. The solution is to customize a. A and then write the bindings and fix it.

2. How to use

Defining interfaces in a core project

Public interface Itools {public void Showinterad ();p ublic void Showbanner ();

and pass it in the game.

public class Gdxgame extends Applicationadapter {spritebatch batch; Texture img;itools tools;public gdxgame (itools tools) {this.tools = tools;} @Overridepublic void Create () {batch = new SpriteBatch (); img = new Texture ("badlogic.jpg"); Tools.showinterad (); Tools.showbanner ();}
Implement the interface in an iOS project and write to the incoming

public class Ioslauncher extends Iosapplication.delegate implements itools{private static final String ad_unit_id = "Ca-ap p-pub-1743332321423234/7283499900 "; static ioslauncher instance; @Overrideprotected iosapplication createapplication () {iosapplicationconfiguration config = new iosapplicationconfiguration (); return new Iosapplication (New Gdxgame ( instance), config);} public static void Main (string[] argv) {instance = new Ioslauncher (); NSAutoreleasePool pool = new NSAutoreleasePool (); Uiapplication.main (argv, NULL, Ioslauncher.class);p ool.close ();        @Overridepublic void Showinterad () {final gadinterstitial interstitial = new gadinterstitial (ad_unit_id); Interstitial.setdelegate (New Gadinterstitialdelegateadapter () {@Override public void Didreceivead (Gadinterst        Itial AD) {super.didreceivead (AD);        Interstitial.present (((iosapplication) gdx.app). Getuiviewcontroller ()); } @Override public void Didfailtoreceivead (gadinterstitial ad,       Gadrequesterror error) {Gdx.app.log ("xxx", Error.getcode () + "");        Super.didfailtoreceivead (AD, error);                }        });        Gadrequest request = Gadrequest.create ();        list<string> devices = new arraylist<string> ();                Devices.add (gadrequest.gad_simulator_id);        Request.settestdevices (Devices); Interstitial.loadrequest (request);} @Overridepublic void Showbanner () {final Gadbannerview Mbannerview = new Gadbannerview (gadadsize.smartbannerportrait ()        );        Mbannerview.setadunitid ("ca-app-pub-1743332321423234/2574098708");                Final Uiviewcontroller controller = ((iosapplication) gdx.app). Getuiviewcontroller ();        Gadrequest request = Gadrequest.create ();        list<string> devices = new arraylist<string> ();        Devices.add (gadrequest.gad_simulator_id);                Mbannerview.setrootviewcontroller (Controller);                Controller.getview (). Addsubview (Mbannerview);Mbannerview.loadrequest (Request);}} 

should be able to read, right? Do not know, please leave a message


3. The most important thing is to build the environment

Since a. A file has been customized, put the libgadadsizewrapped.a file into the iOS project under Build/libs and write the XML

<libs>      <lib>z</lib>        <lib>build/libs/libGADAdSizeWrapped.a</lib>     < /libs>

Putgooglemobileads.framework into the build/libs and find the path in the XML-specific framework ( you have to join these frameworks )

<frameworkPaths><path>build/libs</path> </frameworkPaths> <frameworks> < Framework>uikit</framework> <framework>OpenGLES</framework> <framework>QuartzCore< /framework> <framework>CoreGraphics</framework> <framework>OpenAL</framework> <fram Ework>audiotoolbox</framework> <framework>AVFoundation</framework> <framework> Coretelephony</framework> <framework>EventKit</framework> <framework>messageui</ Framework> <framework>EventKitUI</framework> <framework>systemconfiguration</framework > <framework>CoreMedia</framework> <framework>GoogleMobileAds</framework> </ Frameworks> <weakframeworks><framework>adsupport</framework><framework>storekit</ Framework></weakframeworks>

now that you have finished writing, you can run .... For that custom. A I also went to register a developer account,.... The egg aches 99 DAO The Ocean Heartache

If you feel that you have the help, please praise, thank you!

Source Address: Https://github.com/tianqiujie/robovm-ios-bindings


LIBGDX ROBOVM admob IOS SDK Bindings

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.