Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Event.AD_DISMISSED and adMob — Gideros Forum

Event.AD_DISMISSED and adMob

simwhisimwhi Member
edited February 2015 in Plugins
Hi guys,

Just a quick question. When does the AD_DISMISSED event get executed for adMob?

All the other events are fired except for AD_DISMISSED. I assumed that the event would be fired after the user closes an interstitial ad. Is this correct, or am I missing something?

Many thanks.

Comments

  • It should run when ad is removed/disappears from the screen.
    If it does not happen for you, tell me on which platform and maybe you have an example code? ;)
  • @ar2rsawseen

    1. I'm testing on Android at the moment.
    2. I have cut and paste some of the code below. Both banner and interstitial ads are displayed correctly and all events work except for AD_DISMISSED. Let me know if you need any further info.
    AdManager = Core.class()
     
    function AdManager:init()
      ...
      if self.platform == "Windows" then
        print("Windows platform")
        return true
      else
     
        require("ads")
        --initialise admob
        self.admob = Ads.new("admob")
        -- remove this line on app release
        self.admob:enableTesting()  
        self.admob:addEventListener(Event.AD_FAILED, self.onAdFailed, self )
        self.admob:addEventListener(Event.AD_DISMISSED, self.onAdDismissed, self )
        self.admob:addEventListener(Event.AD_DISPLAYED, self.onAdDisplayed, self )
        self.admob:addEventListener(Event.AD_ACTION_END, self.onAdActionEnd, self )
        self.admob:addEventListener(Event.AD_RECEIVED, self.onAdReceived, self )
     
      end
    end
    function AdManager:showAd(adType, afterAd )
     
      self.afterAd = afterAd
     
      if self.platform == "Windows" then
        print("Windows platform")
        self:_showHouseAd(adType)
        return true
      else
        -- Android or iOS
        if adType == "banner" then
     
          self.admob:setKey(self.adNetwork.admob.banner.key)
          self.admob:showAd("banner")
          local centre = (display.actualContentWidth - self.admob:getWidth()) * 0.5
          self.admob:setPosition( centre , display.screenTop)
     
        elseif adType == "interstitial" then
     
          self.admob:setKey(self.adNetwork.admob.interstitial.key)
          self.admob:showAd(adType)
        else
          print("no adType")
        end
      end
    end
    function AdManager:onAdReceived(e)
     
      app:screenLogger("aAdManager:onAdReceived")
     
       ...
     
    end
    function AdManager:onAdDisplayed(e)
      -- fired when the ad has been displayed
      app:screenLogger("aAdManager:onAdDisplayed")
        ....
    end
    function AdManager:onAdActionEnd(e)
     
      app:screenLogger("aAdManager:onAdActionEnd")
     
       ....
    end
    function AdManager:onAdDismissed(e)
     
      app:screenLogger("AdManager:onAdDismissed")
     
      ....
    end
     
    function AdManager:onAdFailed( e )
     
      app:screenLogger("aAdManager:onAdFailed")
     
      ...
    end
  • @ar2rsawseen

    On further testing I don't get any events if I turn off the WiFi. I assumed that it would raise AD_FAILED event in this situation.
  • @ar2rsawseen

    There maybe a problem with the eclipse project as the app does not start on my colleagues Sony Xperia S. The logcat reports the liblua.so was not found. However, it works on my Lenovo and Nexus 7. I have attached some screenshots in the hope that it is something very simple.

    Many thanks in advance.


    logcat.jpg
    626 x 960 - 169K
    proj1.JPG
    392 x 550 - 50K
    proj2.JPG
    263 x 636 - 37K
    proj3.JPG
    276 x 56 - 12K
  • @ar2rsawseen

    I managed to fix the APK issue described above. I moved the System.loadLibrary("ads");
    to the bottom. My mistake!!! Sorry. It obviously depends on liblua.so.
    public class VSEActivity extends Activity implements OnTouchListener
    {
    	static
    	{
    		System.loadLibrary("gvfs");
    		System.loadLibrary("lua");
    		System.loadLibrary("gideros");
     
    		System.loadLibrary("luasocket");
    		System.loadLibrary("lfs");
    		System.loadLibrary("ggooglebilling");
    		System.loadLibrary("lsqlite3");
    		System.loadLibrary("json");
    		System.loadLibrary("bitop");
    		System.loadLibrary("ads");
    	}
     
    	static private String[] externalClasses = {
    		"com.giderosmobile.android.plugins.googlebilling.GGoogleBilling",
    		"com.giderosmobile.android.plugins.ads.Ads"
    	};
    I'm not sure why it worked on my two devices but not on the Sony.
  • @ar2rsawseen

    I still can't figure out why AD_DISMISSED event is not working. I also still have a problem with AD_FAILED when I turn the wifi off. If it helps, I'm using just test ads.

    Any help with this would be much appreciated.

  • simwhisimwhi Member
    edited February 2015
    @ar2rsawseen

    I found this thread with you adManager class. Looks very neat.

    http://giderosmobile.com/forum/discussion/5189/adsshowadinterstitial-response-delayed/p1

    I see that you use anonymous functions. I also noticed that there are no events registered for AD_DISMISSED. Do you use them at all?
  • The AD_ACTIONEND fires when the interstitial ad button is closed. This is what I need but AD_DISMISSED does not seem to fire for adMob plugin. I also tested using real ads.
  • I fixed AD_FAILED issue by implementing my own check internet available function.
Sign In or Register to comment.