Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ads not loading more than once #57

Closed
dinindu-d opened this Issue Feb 17, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@dinindu-d
Copy link

dinindu-d commented Feb 17, 2019

I’m trying to load Facebook instant game ads several times using two placement IDs using bellow functionality,

-- Preload ad unit
function load_ad_unit(ad_unit_id)
    print("loading ad unit...")
    fbinstant.load_interstitial_ad(
        ad_unit_id,
        function(self, success)
            if success then
                print("Ad unit successfully loaded ")
            else
                print("Ad unit doesn't loaded ", ad_unit_id)
            end
        end
    )
end

-- Show ad unit
function show_ad_unit(ad_unit_id)
    fbinstant.show_interstitial_ad(
        ad_unit_id,
        function(self, success)
            if success then
                print("Ad unit successfully opened ", ad_unit_id)
                -- * I put this here because `show_interstitial_ad`
                -- handles removing the ad instance
                load_ad_unit(ad_unit_id)
            else
                print("Ad unit doesn't opened ", ad_unit_id)
            end
        end
    )
end

function on_message(self, message_id, message, sender)
    if message_id == hash("NEW_GAME") then
        load_ad_unit("<ad_unit_id>")
    elseif message_id == hash("ON_PRESS") then
        show_ad_unit("<ad_unit_id>")
    end
end

But this only works once at the beginning of the game when I press a button. For the second time, it won't work. Below are errors that occur in most situations,

> FBInstant_PlatformShowInterstitialAdAsync - unable to find ad. Did you load it?
> FBInstant_PlatformLoadInterstitialAdAsync - error a {code: "ADS_NO_FILL", message: "No fill"}
> FBInstant_PlatformLoadInterstitialAdAsync - error a {code: "ADS_TOO_MANY_INSTANCES", message: "Too many ad instances"}

This issue is from the forum: https://forum.defold.com/t/facebook-instant-games-ads-not-loading-more-than-once/43392

@britzl

This comment has been minimized.

Copy link
Contributor

britzl commented Mar 8, 2019

Investigating.

@britzl

This comment has been minimized.

Copy link
Contributor

britzl commented Mar 9, 2019

Found the problem. Working on a fix.

@britzl

This comment has been minimized.

Copy link
Contributor

britzl commented Mar 9, 2019

Fixed in 5.0.0. Note the new API:

https://github.com/defold/extension-fbinstant/releases/tag/5.0.0

Please report any problems you might have!

@britzl britzl closed this Mar 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.