Within the past few days google is forcing the use of the Google Play Services Mobile ads as the next version of android adMob. Im completely new to admob and am trying to test ads in my libGDX android game, but cant figure out how to do it because I get a rediculous amount of errors no matter what i do. I HAVE LOOKED AT OTHER EXAMPLES, but they are all for adMob 6.4.1(or earlier) which is now considered legacy. I just want an ad banner at the bottom of the screen but cant figure out how to do it. Could someone please post what my android MainActivity would need to be as well as anything I need to do to the manifest and xml.
It NEEDS to work with libGDX and however the view system would cooperate with that
Thank you very much!
Please follow the inmstruction given to the google official website
https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals
Do Add These Line In The MainActivity.java
Add these lines on Activity OnCreate..
Also Add some lines in Manifest.xml
Now add permissions...
And also don't forgot to add google-play-services as library project.
Hope this will help you.
Follow the official guide on migrating to the new admob here. Then follow the admob in libgdx wiki guide to complete the migration. It's really simple.
The changes you'll need to make in your MainActivity class are:
Change the lines:
to:
Additionally, since you want the ad to appear at the bottom of the screen, modify the adParams as follows:
And in your manifest file,
Change:
to:
You don't need to define the ad view in an xml layout since it's already done programmatically in the MainActivity Class. You can also implement the AdListener to get listen for the Ad callbacks.
The diference between the new admob and the old one is just that key..
I used this tutorial https://code.google.com/p/libgdx/wiki/AdMobInLibgdx And put my new key and works good, and I recieve the statistics, clicks count, etc.
I didn't installed google play service to my app.