Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Android Studio and ads plugin (adMob ads are not being displayed) — Gideros Forum

Android Studio and ads plugin (adMob ads are not being displayed)

simwhisimwhi Member
edited April 2016 in Plugins
I've been trying to get ads working in Gideros 2016-04 over the past few days, but I can't work out why ads are not being displayed. Can anyone point me in the right direction? I can't see the wood for the trees now!!!!

Here are the results of my tests:

1) The logcat output file attached indicates that ads are requested and loaded, but nothing is displayed apart from a white screen. There are also a lot of "can not find class: xxxx" in the log, I've googled it, but I don't know what the error is, or how to fix it. Any ideas?

2) Here is the Android manifest:
<application android:icon="<a href="http://forum.giderosmobile.com/profile/drawable%2Ficon%26quot" rel="nofollow">@drawable/icon&quot</a>; android:label="<a href="http://forum.giderosmobile.com/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name&quot</a>; android:theme="<a href="http://forum.giderosmobile.com/profile/android" rel="nofollow">@android</a>:style/Theme.NoTitleBar.Fullscreen">
        <!-- google play -->
        <meta-data android:name="com.google.android.gms.version" android:value="<a href="http://forum.giderosmobile.com/profile/integer%2Fgoogle_play_services_version%26quot" rel="nofollow">@integer/google_play_services_version&quot</a>; />
        <!-- AppLovin -->
        <meta-data android:name="applovin.sdk.key" android:value="xxxxxxx"  />
        <!-- facebook -->
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="<a href="http://forum.giderosmobile.com/profile/string%2Ffacebook_app_id%26quot" rel="nofollow">@string/facebook_app_id&quot</a>;/>
        <activity android:label="<a href="http://forum.giderosmobile.com/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name&quot</a>; android:name="com.giderosmobile.android.SpeedyGramActivity" android:launchMode="singleTask" android:screenOrientation="sensorLandscape" android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
        <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
        <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
        <activity android:name="com.facebook.LoginActivity" android:theme="<a href="http://forum.giderosmobile.com/profile/android" rel="nofollow">@android</a>:style/Theme.Translucent.NoTitleBar" android:label="<a href="http://forum.giderosmobile.com/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name&quot</a>; />
 
    	<!-- TAG:APPLICATION-EXTRA -->
    </application>
</manifest>
3) Here is the test app that I used to test my custom player:
require "ads"
print("ads require")
ads = Ads.new("admob")
 
ads:addEventListener(Event.AD_RECEIVED, function()
	print("ads AD_RECEIVED")
end)
 
ads:addEventListener(Event.AD_FAILED, function(e)
	print("ads AD_FAILED", e.error)
end)
 
ads:addEventListener(Event.AD_ACTION_BEGIN, function()
	print("ads AD_ACTION_BEGIN")
end)
 
ads:addEventListener(Event.AD_ACTION_END, function()
	print("ads AD_ACTION_END")
end)
 
ads:addEventListener(Event.AD_DISMISSED, function()
	print("ads AD_DISMISSED")
end)
 
ads:addEventListener(Event.AD_ERROR, function(e)
	print("ads AD_ERROR", e.error)
end)
 
ads:setKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
 
print("set key")
ads:showAd("banner")
print("show banner")
4) Here is the console output that shows that the plugin is initialised and an ad was received.
adframeworks/admob.lua is uploading.
Uploading finished.
ads require
set key
show banner
ads AD_RECEIVED

Comments

  • ar2rsawseenar2rsawseen Maintainer
    From both lua output and logcat ouput all seems to be working fine. try this code:
    require "ads"
    print("ads require")
    ads = Ads.new("admob")
    ads:addEventListener(Event.AD_RECEIVED, function()
    	print("ads AD_RECEIVED")
    	ads:show("auto")
    end)
    ads:setKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
    ads:enableTesting()
    print("set key")
    ads:showAd("auto")
  • ar2rsawseenar2rsawseen Maintainer
    Ah, I forgot, in new Admob you need to provide unit Id, or something like that, as per interface docs:
    http://docs.giderosmobile.com/interface/ads

    don't remember, have not used them for a while :)
  • @ar2rsawseen Thanks for the speedy response. I'm using an Ad Unit ID with the following format:

    ca-app-pub-xxxxxxxxxxx/yyyyyyyyyyyy

    The app is linked to our adMob account and impressions have been recorded (just 2).

    I used your code above, but I had to change the following line of code:
    ads:addEventListener(Event.AD_RECEIVED, function()
    	print("ads AD_RECEIVED")
            ads:showAd("auto") -- change this from show -> showAd
    end)
    I still get a blank (white) screen. Any more suggestions?
  • @ar2rsawseen I tested my Gideros player on other devices (Samsung Tab and Nexus 7) and the ads work fine. So, it's my Huawei P6 LTE that's the problem!!

  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    @simwhi this is first I encounter something like that.
    Maybe there is an ad blocker on that device, or something like that?
  • simwhisimwhi Member
    edited April 2016
    @ar2rsawseen An interesting point. I haven't personally installed an ad blocker on that device myself, but I will check. It's my personal phone, not a phone I usually use for development. I'll let you know what I find.

    UPDATE: I just checked my phone and noticed an app called "Browser". It was the last app that was installed on my device, so I uninstalled it. The ads now appear now.

    I have no idea how it got there as I only download apps that are available on Google play.

    Thanks @ar2rsawseen for your help.
Sign In or Register to comment.