{"action":"created","issue":{"url":"https://api.github.com/repos/robovm/robovm-robopods/issues/39","labels_url":"https://api.github.com/repos/robovm/robovm-robopods/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/robovm/robovm-robopods/issues/39/comments","events_url":"https://api.github.com/repos/robovm/robovm-robopods/issues/39/events","html_url":"https://github.com/robovm/robovm-robopods/issues/39","id":107236318,"number":39,"title":"LibGDX + RoboPods. Sample working version with Google AdMob ","user":{"login":"caiob3","id":4964245,"avatar_url":"https://avatars.githubusercontent.com/u/4964245?v=3","gravatar_id":"","url":"https://api.github.com/users/caiob3","html_url":"https://github.com/caiob3","followers_url":"https://api.github.com/users/caiob3/followers","following_url":"https://api.github.com/users/caiob3/following{/other_user}","gists_url":"https://api.github.com/users/caiob3/gists{/gist_id}","starred_url":"https://api.github.com/users/caiob3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caiob3/subscriptions","organizations_url":"https://api.github.com/users/caiob3/orgs","repos_url":"https://api.github.com/users/caiob3/repos","events_url":"https://api.github.com/users/caiob3/events{/privacy}","received_events_url":"https://api.github.com/users/caiob3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-18T16:37:45Z","updated_at":"2015-09-21T15:50:09Z","closed_at":null,"body":"Hi,\r\n\r\nI have finished a game-app which uses Parse.com and Google AdMob. The android version was already published to the Play Store. In order to finish the iOS version of the game-ap, I'm trying to use the new RoboPods to integrate both (Parse and AdMob).\r\n\r\nMy question here is how to display Ads on iPhone/iPad... (AdMob integration)?\r\n\r\nI can successfully launch the iOS Simulator from Android Studio (which I used as my Intellij/Gradle environment to develop...), however I could't find any simple-sample-version that simply displays a BannerView at the bottom of the screen (for exemple). \r\n\r\nMy *build.gradle* file is:\r\n\r\n```\r\nbuildscript {\r\n    repositories {\r\n        mavenCentral()\r\n        maven { url \"https://oss.sonatype.org/content/repositories/snapshots/\" }\r\n        jcenter()\r\n    }\r\n    dependencies {\r\n        classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'\r\n        classpath 'com.android.tools.build:gradle:1.2.3'\r\n        classpath 'org.robovm:robovm-gradle-plugin:1.6.0'\r\n    }\r\n}\r\n\r\nallprojects {\r\n    apply plugin: \"eclipse\"\r\n    apply plugin: \"idea\"\r\n\r\n    version = '1.0'\r\n    ext {\r\n        appName = 'car-game'\r\n        gdxVersion = '1.6.5'\r\n        roboVMVersion = '1.6.0'\r\n        box2DLightsVersion = '1.4'\r\n        ashleyVersion = '1.6.0'\r\n        aiVersion = '1.5.0'\r\n    }\r\n\r\n    repositories {\r\n        mavenCentral()\r\n        maven { url \"https://oss.sonatype.org/content/repositories/snapshots/\" }\r\n        maven { url \"https://oss.sonatype.org/content/repositories/releases/\" }\r\n    }\r\n}\r\n....\r\n....\r\n....\r\n\r\n\r\nproject(\":ios\") {\r\n    apply plugin: \"java\"\r\n    apply plugin: \"robovm\"\r\n\r\n\r\n    dependencies {\r\n        compile project(\":core\")\r\n        compile \"org.robovm:robovm-rt:$roboVMVersion\"\r\n        compile \"org.robovm:robovm-cocoatouch:$roboVMVersion\"\r\n        compile \"com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion\"\r\n        compile \"com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios\"\r\n        compile \"com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios\"\r\n\r\n\r\n        compile \"org.robovm:robopods-google-mobile-ads-ios:1.6.0\"\r\n\r\n    }\r\n}\r\n```\r\n\r\n\r\n\r\nAlso I had first changed manually the file \"robovm.xml\", \r\n\r\nbut with the new RoboPods, I changed back as the original (not sure, Bellow the original)\r\n\r\n\r\n```\r\n<config>\r\n    <executableName>${app.executable}</executableName>\r\n    <mainClass>${app.mainclass}</mainClass>\r\n    <os>ios</os>\r\n    <arch>thumbv7</arch>\r\n\r\n    <target>ios</target>\r\n    <iosInfoPList>Info.plist.xml</iosInfoPList>\r\n    <resources>\r\n        <resource>\r\n            <directory>../android/assets</directory>\r\n            <includes>\r\n                <include>**</include>\r\n            </includes>\r\n            <skipPngCrush>true</skipPngCrush>\r\n        </resource>\r\n        <resource>\r\n            <directory>data</directory>\r\n        </resource>\r\n    </resources>\r\n    <forceLinkClasses>\r\n        <pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>\r\n        <pattern>com.badlogic.gdx.graphics.g3d.particles.**</pattern>\r\n        <pattern>com.android.okhttp.HttpHandler</pattern>\r\n        <pattern>com.android.okhttp.HttpsHandler</pattern>\r\n        <pattern>com.android.org.conscrypt.**</pattern>\r\n        <pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>\r\n        <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings</pattern>\r\n        <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi</pattern>\r\n        <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std</pattern>\r\n        <pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>\r\n        <pattern>com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL</pattern>\r\n        <pattern>org.apache.harmony.security.provider.cert.DRLCertFactory</pattern>\r\n        <pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>\r\n    </forceLinkClasses>\r\n    <libs>\r\n        <lib>z</lib>\r\n    </libs>\r\n    <frameworks>\r\n        <framework>UIKit</framework>\r\n        <framework>OpenGLES</framework>\r\n        <framework>QuartzCore</framework>\r\n        <framework>CoreGraphics</framework>\r\n        <framework>OpenAL</framework>\r\n        <framework>AudioToolbox</framework>\r\n        <framework>AVFoundation</framework>\r\n    </frameworks>\r\n</config>\r\n```\r\n\r\n\r\n\r\nMy question is: How my \"IOSLauncher.java\" should look like in order to launch the game (of course...) and display a BannerAd at the bottom?\r\n\r\nAny help would be great. A sample would EVEN better.\r\nThank you all in advance "},"comment":{"url":"https://api.github.com/repos/robovm/robovm-robopods/issues/comments/142023470","html_url":"https://github.com/robovm/robovm-robopods/issues/39#issuecomment-142023470","issue_url":"https://api.github.com/repos/robovm/robovm-robopods/issues/39","id":142023470,"user":{"login":"caiob3","id":4964245,"avatar_url":"https://avatars.githubusercontent.com/u/4964245?v=3","gravatar_id":"","url":"https://api.github.com/users/caiob3","html_url":"https://github.com/caiob3","followers_url":"https://api.github.com/users/caiob3/followers","following_url":"https://api.github.com/users/caiob3/following{/other_user}","gists_url":"https://api.github.com/users/caiob3/gists{/gist_id}","starred_url":"https://api.github.com/users/caiob3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caiob3/subscriptions","organizations_url":"https://api.github.com/users/caiob3/orgs","repos_url":"https://api.github.com/users/caiob3/repos","events_url":"https://api.github.com/users/caiob3/events{/privacy}","received_events_url":"https://api.github.com/users/caiob3/received_events","type":"User","site_admin":false},"created_at":"2015-09-21T15:50:09Z","updated_at":"2015-09-21T15:50:09Z","body":"Hi @BlueRiverInteractive, thank you for posting here. I have JUST found the issue right now. It was something wrong on my **IOSLauncher.java** (my bad... rs)\r\n\r\nI understand the previous tutorial is outdated, but I followed and just with small small changes, I got (FINALLY) working. On iPads and also IOS Simulator.\r\n\r\nBellow is my final code, followed by the Tutorial link I posted previously which can help someone one day :)\r\n\r\n```javascript\r\n\r\nimport com.badlogic.gdx.Application;\r\nimport com.badlogic.gdx.backends.iosrobovm.IOSApplication;\r\nimport com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;\r\nimport com.badlogic.gdx.utils.Logger;\r\n\r\nimport org.robovm.apple.coregraphics.CGRect;\r\nimport org.robovm.apple.coregraphics.CGSize;\r\nimport org.robovm.apple.foundation.Foundation;\r\nimport org.robovm.apple.foundation.NSArray;\r\nimport org.robovm.apple.foundation.NSAutoreleasePool;\r\nimport org.robovm.apple.foundation.NSObject;\r\nimport org.robovm.apple.foundation.NSString;\r\nimport org.robovm.apple.uikit.UIApplication;\r\nimport org.robovm.apple.uikit.UIScreen;\r\nimport org.robovm.pods.google.mobileads.GADAdSize;\r\nimport org.robovm.pods.google.mobileads.GADBannerView;\r\nimport org.robovm.pods.google.mobileads.GADBannerViewDelegateAdapter;\r\nimport org.robovm.pods.google.mobileads.GADRequest;\r\nimport org.robovm.pods.google.mobileads.GADRequestError;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n\r\npublic class IOSLauncher extends IOSApplication.Delegate {\r\n\r\n    private static CGSize AD_SIZE;\r\n\r\n\r\n    private static final Logger log = new Logger(IOSLauncher.class.getName(), Application.LOG_DEBUG);\r\n    private static final boolean USE_TEST_DEVICES = true;\r\n    private GADBannerView adview;\r\n    private boolean adsInitialized = false;\r\n    private IOSApplication iosApplication;\r\n\r\n    @Override\r\n    protected IOSApplication createApplication() {\r\n        // Create the listeners\r\n        ShowAdListener show = new ShowAdListener();\r\n        HideAdListener hide = new HideAdListener();\r\n        show.setBase(this);\r\n        hide.setBase(this);\r\n\r\n        // Create the LibGDX app and add the listeners\r\n       <MY_PACKAGE_NAME>.MainGame app = new <MY_PACKAGE_NAME>.MainGame();\r\n        app.addListener(show);\r\n        app.addListener(hide);\r\n\r\n\r\n        // Run the app\r\n        IOSApplicationConfiguration config = new IOSApplicationConfiguration();\r\n        config.orientationLandscape = false; \r\n        config.orientationPortrait = true; \r\n\r\n        iosApplication = new IOSApplication(app, config);\r\n\r\n        return iosApplication;\r\n    }\r\n\r\n    public static void main(String[] argv) {\r\n        NSAutoreleasePool pool = new NSAutoreleasePool();\r\n        UIApplication.main(argv, null, IOSLauncher.class);\r\n        pool.close();\r\n    }\r\n\r\n    // Ads\r\n    public void showAd() {\r\n\r\n\r\n        //System.out.println(\"Showing Ad\");\r\n        Foundation.log(\"Showing Ad\");\r\n\r\n        initializeAds();\r\n\r\n        final CGSize screenSize = UIScreen.getMainScreen().getBounds().getSize();\r\n        double screenWidth = screenSize.getWidth();\r\n\r\n        AD_SIZE = adview.getBounds().getSize();\r\n        double adWidth = AD_SIZE.getWidth();\r\n        double adHeight = AD_SIZE.getHeight();\r\n\r\n        log.debug(String.format(\"Hidding ad. size[%s, %s]\", adWidth, adHeight));\r\n\r\n        float bannerWidth = (float) screenWidth;\r\n        float bannerHeight = (float) (bannerWidth / adWidth * adHeight);\r\n\r\n        if (true) {\r\n            adview.setFrame(new CGRect((screenWidth / 2) - adWidth / 2, 0, bannerWidth, bannerHeight));\r\n        } else {\r\n            adview.setFrame(new CGRect(0, -bannerHeight, bannerWidth, bannerHeight));\r\n        }\r\n    }\r\n\r\n    public void hideAd() {\r\n\r\n        if (adsInitialized) {\r\n\r\n            //System.out.println(\"Hiding Ad\");\r\n            Foundation.log(\"Hiding Ad\");\r\n\r\n            final CGSize screenSize = UIScreen.getMainScreen().getBounds().getSize();\r\n            double screenWidth = screenSize.getWidth();\r\n\r\n\r\n            AD_SIZE = adview.getBounds().getSize();\r\n            double adWidth = AD_SIZE.getWidth();\r\n            double adHeight = AD_SIZE.getHeight();\r\n\r\n            float bannerWidth = (float) screenWidth;\r\n            float bannerHeight = (float) (bannerWidth / adWidth * adHeight);\r\n\r\n            adview.setFrame(new CGRect(0, -bannerHeight, bannerWidth, bannerHeight));\r\n        }\r\n\r\n    }\r\n\r\n\r\n    public void initializeAds() {\r\n\r\n        if (!adsInitialized) {\r\n            //log.debug(\"Initalizing ads...\");\r\n            Foundation.log(\"Initalizing ads...\");\r\n\r\n            adsInitialized = true;\r\n\r\n\r\n            adview = new GADBannerView(GADAdSize.SmartBannerPortrait());\r\n            adview.setAdUnitID(\"ca-app-pub-XXXXXXXXX/XXXXXXXXX\"); //put your secret key here\r\n            adview.setRootViewController(iosApplication.getUIViewController());\r\n            iosApplication.getUIViewController().getView().addSubview(adview);\r\n\r\n\r\n            final GADRequest request = new GADRequest();\r\n\r\n\r\n            if (USE_TEST_DEVICES) {\r\n                final NSArray<NSObject> testDevices = new NSArray<NSObject>(\r\n                        new NSString(GADRequest.getSimulatorID()));\r\n\r\n\r\n                List<String> list = new ArrayList<>();\r\n                list.add(GADRequest.getSimulatorID());\r\n\r\n                request.setTestDevices(list);\r\n\r\n                //log.debug(\"Test devices: \" + request.getTestDevices());\r\n                Foundation.log(\"Test devices: \" + request.getTestDevices());\r\n            }\r\n\r\n            adview.setDelegate(new GADBannerViewDelegateAdapter() {\r\n                @Override\r\n                public void didReceiveAd(GADBannerView view) {\r\n                    super.didReceiveAd(view);\r\n                    log.debug(\"didReceiveAd\");\r\n                }\r\n\r\n                @Override\r\n                public void didFailToReceiveAd(GADBannerView view,\r\n                                               GADRequestError error) {\r\n                    super.didFailToReceiveAd(view, error);\r\n                    //log.debug(\"didFailToReceiveAd:\" + error);\r\n                    Foundation.log(\"ERROR at didFailToReceiveAd: \" + error);\r\n                }\r\n            });\r\n\r\n            adview.loadRequest(request);\r\n\r\n            //log.debug(\"Initalizing ads complete.\");\r\n            Foundation.log(\"Initalizing ads complete.\");\r\n        }\r\n    }\r\n}\r\n\r\n\r\n```\r\n\r\nLast question, would be possible to not have the AdView BELLOW the gameScreen on iOS (not overlapping as it is)? I managed that on Android adding Layout Params, but would be possible do the same for iPhone?"}}