Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Why does a RevMob#load call already display the ad? — Gideros Forum

Why does a RevMob#load call already display the ad?

seppseppseppsepp Member
edited August 2014 in General questions
Hi @all,

assumed ad delivery works at all (see http://giderosmobile.com/forum/discussion/comment/38412#Comment_38412 ;) ): Why does a RevMob#load call already display the ad? Isn't RevMob able to preload the ad? If so it would be super cool when this call wouldn't do anything or if the would be a method to check whether the provider supports the preloading mechanism =| .

Thanks and greetings

Sebastian

Comments

  • Ok, that's becoming weird now! Even when I strip all the code except the following lines, the ad is already displayed (success listener gets called to).
    self.ad = Ads.new(self.providerId)
    self.ad:setKey(self.mediaId)
  • Interesting, from the code I see that
    banner is added to the view hierarhcy when two conditions are true
    1) banner is loaded
    2) show method was called to set the shouldShow bool property to true.

    Are you sure you are not calling ad:showAd somewhere in the code?
    That would also explain the "WARNING: USING ADS WITHOUT STARTING A SESSION COULD PRODUCE UNPREDICTED BEHAVIOUR!"

    in both cases, it seems that ad:showAd is called somewhere (possibly before setKey method is called)
  • I wrapped the whole ad stuff so I'm able to enable / disable behaviour very easy at one place.

    I now cleaned up the Ads eventlistener meaning each event got it's own listener.

    The code create two different ads. One for a banner (auto). And one for an interstitial. Thats why the init, enableTesting and load part appears twice.

    This is the player log:
    Uploading finished.
    Ad#init
    Ad#enableTesting
    Ad#load
    Ad#init
    Ad#enableTesting
    Ad#load
    Ad#onReceived
    Ad#onReceived
    Ad#onReceived
    Ad#onReceived
    Ad#show
    Ad#onDisplayed
    Ad#onDisplayed
    What I don't understand is why the onReceived event is fired twice per ad =| ^^ . Same for the onDisplayed event.


    This is the Xcode output:
    2014-08-26 11:12:30.669 vamos[4239:60b] [RevMob] Starting RevMobAds
    2014-08-26 11:12:30.755 vamos[4239:60b] [RevMob] Testing mode with ads
    2014-08-26 11:12:30.757 vamos[4239:60b] Reachability Flag Status: -R -----l- networkStatusForFlags
    2014-08-26 11:12:30.758 vamos[4239:60b] [RevMob] WARNING: SESSION NOT STARTED!! UNEXPECT BEHAVIOUR CAN OCCOUR!!
    2014-08-26 11:12:30.759 vamos[4239:60b] [RevMob] Initializating Banner.
    2014-08-26 11:12:30.760 vamos[4239:60b] [RevMob] Requesting banner data.
    2014-08-26 11:12:30.767 vamos[4239:60b] [RevMob] WARNING: USING ADS WITHOUT STARTING A SESSION COULD PRODUCE UNPREDICTED BEHAVIOUR!
    2014-08-26 11:12:30.767 vamos[4239:60b] [RevMob] Testing mode off
    2014-08-26 11:12:30.768 vamos[4239:60b] [RevMob] Parallax effect disabled
    2014-08-26 11:12:30.769 vamos[4239:60b] [RevMob] Testing mode with ads
    2014-08-26 11:12:30.770 vamos[4239:60b] Reachability Flag Status: -R -----l- networkStatusForFlags
    2014-08-26 11:12:30.771 vamos[4239:60b] [RevMob] WARNING: SESSION NOT STARTED!! UNEXPECT BEHAVIOUR CAN OCCOUR!!
    2014-08-26 11:12:30.772 vamos[4239:60b] [RevMob] Initializing Fullscreen.
    2014-08-26 11:12:30.777 vamos[4239:60b] [RevMob] WARNING: USING ADS WITHOUT STARTING A SESSION COULD PRODUCE UNPREDICTED BEHAVIOUR!
    Thanks a lot for your help, @ar2rsawseen!
  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    @seppsepp ah I see,
    you need to create only one single revmob instance, it will be able to manage both banner and interstitial.
    Two revmob instances is probably what messing it all up now

    Can you try everything with one single revmob instance?
  • Woohoo! Ok, having more than one instance of Ads confused everything it seems :D . I changed it to just having one instance ... et voilà it works fine. Thanks a lot for your help!
  • Hey @ar2rsawseen, any idea whether calling Ad#load after Ad#setKey instantly causes errors like that ^^ ... the "not yet started session" thing. Because when the app does so, RevMob seems to get confused again - not in the Gideros Player, but in the build app. No ads loaded then. There is no callback for Ad#setKey or something, right?

    Thanks a lot in advance for your help =) !
  • Hmm, interesting I really don't know.
    From their docs:
    To start a RevMob session just call the startSession:
    http://sdk.revmobmobileadnetwork.com/ios.html
    No callback no nothing

    And now that you have said I also noticed that warning poping up in Log

    EDIT
    I also noticed that in swift you do provide a callback to setting session:
    RevMobAds.startSessionWithAppID("copy your RevMob Media ID here",
    withSuccessHandler: completionBlock, andFailHandler: errorBlock);

    But in Objective-C no callback provided
  • seppseppseppsepp Member
    edited September 2014
    Hm. Ok, thanks for the info.

    The reason why I want to preload the ads is, that when I don't the ad is first displayed and then positioned - which results in very short flickering, meaning the ad (banner) is visible for a very short time (one frame maybe?) at the top. Positioning the banner in the received and displayed callback doesn't help =| .
  • To keep you up to date: I've contacted the RevMob support and now I'm waiting for some response.
  • Plus: When I call Ads#load a bit later, right now 3 seconds via Timer#delayedCall, then things work fine. Maybe I should stretch time on starting the app a bit ;) . With a looong logo scene or something ;) .

    Btw: What would happen to ads when the app goes to background comes back after a while? Restart of the session and same problems then? Hm ...
  • Btw: I haven't tried it before, but I get the same result ^^ for Ads#show when called too early after Ads#setKey.
  • @seppsepp
    Yes Ads:show and Ads:load basically does the same, except first also adds the add to the rendering tree

    And yes basically it seems there should be a callback but I did not find it when I was implementing it.

    Going to background and back does nothing, only the cold start seems to be reseting session :)
  • Finally ... the app now has a startup screen with a nice jingle which lasts for about eight seconds. The interval seems to be long enough to get the ads preloaded. *sigh*
Sign In or Register to comment.