defold / extension-admob

Defold native extension which provides access to AdMob functionality on Android and iOS
https://www.defold.com/extension-admob/
MIT License
37 stars 12 forks source link

banners not showing up #26

Closed robertnicjoo closed 7 months ago

robertnicjoo commented 1 year ago

Logic

  1. I have created separate script for my ads and added it to my game collection
  2. I sent post message to my ads script from my collection init()
  3. I process the banner ad and post message to my collection script that banner has been loaded

so far all logic above are working and I can see messages in my android studio logcat but the issue is banner is not showing up in my screen.

Here is my code:

easy.gui_script

function init(self)
    msg.post(".", "acquire_input_focus")
    msg.post("@render:", "use_fixed_fit_projection")

    -- Loading banner ads on screen initialization
    msg.post("go#ads", "initialization_box")
    msg.post("go#ads", "show_initialize")
    msg.post("go#ads", "show_banner")
end

function on_message(self, message_id, message, sender)
    if message_id == hash("reward_finished") then
        print("reward finished")
        gui.set_visible(gui.get_node("getreward"),false)
        gui.set_visible(gui.get_node("playbyreward"),false)
        gui.set_visible(gui.get_node("backtomenu"),false)
        gui.set_visible(gui.get_node("playagain"),false)
    end
    if message_id == hash("banner_finished") then
        print("banner finished")
    end
    if message_id == hash("interstitial_finished") then
        print("interstitial finished")
    end
end

ads.script

local MAX_LOG_LINES = 10

--log logic
local gprint = print
local log = {}
local text = ""
_G.print = function(...)
    gprint(...)
    local args = {...}
    local num = #log+1
    log[num] = "--"
    for k, v in pairs(args) do
        log[num] = log[num] .. tostring(v) .. " "
    end
    log[num] = log[num] .. "\n"
    text = ""
    if num > MAX_LOG_LINES then
        table.remove(log, 1)
    end
    for k, v in pairs(log) do
        text = text .. v
    end
end

function update()
    -- gui.set_text(gui.get_node("console"), text)
end
-- end log logic

local function update_ui(self)
    -- self.initialized = true
    -- gui.set_enabled(gui.get_node("inited"), self.initialized)
    -- gui.set_enabled(gui.get_node("initialization_box"), not self.initialized)
    if self.ad_type then
        if self.ad_type == admob.MSG_INTERSTITIAL then
            admob.is_interstitial_loaded()
        elseif self.ad_type == admob.MSG_REWARDED then
            admob.is_rewarded_loaded()
        elseif self.ad_type == admob.MSG_BANNER then
            admob.is_banner_loaded()
        end
    end
end

-- local function set_block_height(height)
--  -- use banner height in gui
--  local screen_width, screen_height = window.get_size()
--  local settings_height = tonumber(sys.get_config("display.height"))
--  local mult = screen_height/settings_height
--  local height_b_node = gui.get_node("height_b")
--  local size = gui.get_size(height_b_node)
--  size.y = height/mult
--  gui.set_size(height_b_node, size)
-- end

local function admob_callback(self, message_id, message)
    if message_id == admob.MSG_INITIALIZATION then
        self.initialized = true
        if message.event == admob.EVENT_COMPLETE then
            print("EVENT_COMPLETE: Initialization complete")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error "..message.error)
        end
    elseif message_id == admob.MSG_IDFA then
        if message.event == admob.EVENT_STATUS_AUTHORIZED then
            print("EVENT_STATUS_AUTHORIZED: ATTrackingManagerAuthorizationStatusAuthorized")
        elseif message.event == admob.EVENT_STATUS_DENIED then
            print("EVENT_STATUS_DENIED: ATTrackingManagerAuthorizationStatusDenied")
        elseif message.event == admob.EVENT_STATUS_NOT_DETERMINED then
            print("EVENT_STATUS_NOT_DETERMINED: ATTrackingManagerAuthorizationStatusNotDetermined")
        elseif message.event == admob.EVENT_STATUS_RESTRICTED then
            print("EVENT_STATUS_RESTRICTED: ATTrackingManagerAuthorizationStatusRestricted")
        elseif message.event == admob.EVENT_NOT_SUPPORTED then
            print("EVENT_NOT_SUPPORTED: IDFA request not supported on this platform or OS version")
        end
    elseif message_id == admob.MSG_INTERSTITIAL then
        if message.event == admob.EVENT_CLOSED then
            print("EVENT_CLOSED: Interstitial AD closed")
        elseif message.event == admob.EVENT_FAILED_TO_SHOW then
            print("EVENT_FAILED_TO_SHOW: Interstitial AD failed to show\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_OPENING then
            -- on android this event fire only when ADS activity closed =(
            print("EVENT_OPENING: Interstitial AD is opening")
        elseif message.event == admob.EVENT_FAILED_TO_LOAD then
            print("EVENT_FAILED_TO_LOAD: Interstitial AD failed to load\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_LOADED then
            print("EVENT_LOADED: Interstitial AD loaded")
        elseif message.event == admob.EVENT_NOT_LOADED then
            print("EVENT_NOT_LOADED: can't call show_interstitial() before EVENT_LOADED\nError: "..message.error)
        elseif message.event == admob.EVENT_IMPRESSION_RECORDED then
            print("EVENT_IMPRESSION_RECORDED: Interstitial did record impression")
        elseif message.event == admob.EVENT_CLICKED then
            print("EVENT_CLICKED: Interstitial clicked")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error: "..message.error)
        end
    elseif message_id == admob.MSG_REWARDED then
        if message.event == admob.EVENT_CLOSED then
            print("EVENT_CLOSED: Rewarded AD closed")
        elseif message.event == admob.EVENT_FAILED_TO_SHOW then
            print("EVENT_FAILED_TO_SHOW: Rewarded AD failed to show\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_OPENING then
            -- on android this event fire only when ADS activity closed =(
            print("EVENT_OPENING: Rewarded AD is opening")
        elseif message.event == admob.EVENT_FAILED_TO_LOAD then
            print("EVENT_FAILED_TO_LOAD: Rewarded AD failed to load\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_LOADED then
            print("EVENT_LOADED: Rewarded AD loaded")
        elseif message.event == admob.EVENT_NOT_LOADED then
            print("EVENT_NOT_LOADED: can't call show_rewarded() before EVENT_LOADED\nError: "..message.error)
        elseif message.event == admob.EVENT_EARNED_REWARD then
            print("EVENT_EARNED_REWARD: Reward: " .. tostring(message.amount) .. " " .. tostring(message.type))
        elseif message.event == admob.EVENT_IMPRESSION_RECORDED then
            print("EVENT_IMPRESSION_RECORDED: Rewarded did record impression")
        elseif message.event == admob.EVENT_CLICKED then
            print("EVENT_CLICKED: Rewarded clicked")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error: "..message.error)
        end
    elseif message_id == admob.MSG_BANNER then
        if message.event == admob.EVENT_LOADED then
            print("EVENT_LOADED: Banner AD loaded. Height: "..message.height.."px Width: "..message.width.."px")
            set_block_height(message.height)
        elseif message.event == admob.EVENT_OPENING then
            print("EVENT_OPENING: Banner AD is opening")
        elseif message.event == admob.EVENT_FAILED_TO_LOAD then
            print("EVENT_FAILED_TO_LOAD: Banner AD failed to load\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_CLICKED then
            print("EVENT_CLICKED: Banner AD clicked")
        elseif message.event == admob.EVENT_CLOSED then
            print("EVENT_CLOSED: Banner AD closed")
        elseif message.event == admob.EVENT_DESTROYED then
            print("EVENT_DESTROYED: Banner AD destroyed")
        elseif message.event == admob.EVENT_IMPRESSION_RECORDED then
            print("EVENT_IMPRESSION_RECORDED: Banner did record impression")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error: "..message.error)
        end
    end
    update_ui(self)
end

function init(self)
    msg.post(".", "acquire_input_focus")

    local engine_info = sys.get_engine_info()
    self.is_debug = engine_info.is_debug

    if self.is_debug then
        if sys.get_sys_info().system_name == 'iPhone OS' then
            self.banner_ad_unit = "ca-app-pub-3940256099942544/2934735716" -- test unit for banners
            self.interstitial_ad_unit = "ca-app-pub-3940256099942544/4411468910" -- test unit for interstitial
            self.rewardedvideo_ad_unit = "ca-app-pub-3940256099942544/1712485313" -- test unit for rewarded
        else --Android
            self.banner_ad_unit = "ca-app-pub-3940256099942544/6300978111" -- test unit for banners
            self.interstitial_ad_unit = "ca-app-pub-3940256099942544/1033173712" -- test unit for interstitial
            self.rewardedvideo_ad_unit = "ca-app-pub-3940256099942544/5224354917" -- test unit for rewarded
        end
    else
        if sys.get_sys_info().system_name == 'iPhone OS' then
            self.banner_ad_unit = "xxxxxxx" -- real
            self.interstitial_ad_unit = "xxxxxxx" -- real
            self.rewardedvideo_ad_unit = "xxxxxxx" --  real
        else --Android
            self.banner_ad_unit = "xxxxxxx" --  real
            self.interstitial_ad_unit = "xxxxxxx" -- real
            self.rewardedvideo_ad_unit = "xxxxxxx" -- real
        end
    end

    self.show_pos = 1
    self.banner_positions = {
        "POS_BOTTOM_CENTER",
        "POS_BOTTOM_LEFT",
        "POS_BOTTOM_RIGHT",
        "POS_NONE",
        "POS_TOP_LEFT",
        "POS_TOP_CENTER",
        "POS_TOP_RIGHT",
        "POS_CENTER"
    }

    if admob then
        admob.set_callback(admob_callback)
        admob.set_privacy_settings(true)
    end
    update_ui(self)
end

function final(self)
    msg.post(".", "release_input_focus")
end

function on_message(self, message_id, message, sender)
    if not admob then
        return
    end

    local prev_type = self.ad_type

    if prev_type ~= self.ad_type then
        update_ui(self)
    end

    if message_id == hash("initialization_box") then
        self.initialized = true
        print("initialization_box DONE!")
        if message_id == hash("show_initialize") then
            print("admob.initialize()")
            admob.initialize()
        end
    end

    if message_id == hash("show_idfa") then
        print("admob.request_idfa()")
        admob.request_idfa()
    end

    if message_id == hash("show_reward") then
        self.ad_type = admob.MSG_REWARDED
        print("admob.load_rewarded()")
        admob.load_rewarded(self.rewardedvideo_ad_unit)
        print("admob.show_rewarded()")
        admob.show_rewarded()
        msg.post("easy:/go#easygui", "reward_finished")
    end

    if message_id == hash("show_banner") then
        self.ad_type = admob.MSG_BANNER
        print("admob.load_banner()")
        admob.load_banner(self.banner_ad_unit)
        print("admob.show_banner( admob."..self.banner_positions[self.show_pos]..")")
        admob.show_banner(admob[self.banner_positions[self.show_pos]])
        self.show_pos = self.show_pos + 1
        if self.show_pos > #self.banner_positions then
            self.show_pos = 1
        end
        msg.post("easy:/go#easygui", "banner_finished")
    end

    if message_id == hash("show_interstitial") then
        self.ad_type = admob.MSG_INTERSTITIAL
        print("admob.load_interstitial()")
        admob.load_interstitial(self.interstitial_ad_unit)
        print("admob.show_interstitial()")
        admob.show_interstitial()
        msg.post("easy:/go#easygui", "interstitial_finished")
    end

    if message_id == hash("show_inspector") then
        print("admob.show_ad_inspector()")
        admob.show_ad_inspector()
    end
end

Screenshot

Screen Shot 2022-11-04 at 12 44 29

Any suggestions?

britzl commented 1 year ago

Hmm,. that's strange. @AGulev do you have any ideas?

AGulev commented 1 year ago

@robertnicjoo you try to show banner before you have loaded it. Load banner is async operation. That menas you have to wait for EVENT_LOADED for banner after calling admob.load_banner() (see EVENT_LOADED: Banner AD loaded. in callback). And then, when it's loaded - call admob.show_banner(admob.POS_BOTTOM_CENTER) in callback.

robertnicjoo commented 1 year ago

@robertnicjoo you try to show banner before you have loaded it. Load banner is async operation. That menas you have to wait for EVENT_LOADED for banner after calling admob.load_banner() (see EVENT_LOADED: Banner AD loaded. in callback). And then, when it's loaded - call admob.show_banner(admob.POS_BOTTOM_CENTER) in callback.

Hi @AGulev thanks for trying to help, i did make changes based on your suggestion, here is the results:

1- banner still not showing. 2- app crash after reward video played and closed by x button.

here is my code changes (look for -- added -- removed tags)

ads.script

local MAX_LOG_LINES = 10

--log logic
local gprint = print
local log = {}
local text = ""
_G.print = function(...)
    gprint(...)
    local args = {...}
    local num = #log+1
    log[num] = "--"
    for k, v in pairs(args) do
        log[num] = log[num] .. tostring(v) .. " "
    end
    log[num] = log[num] .. "\n"
    text = ""
    if num > MAX_LOG_LINES then
        table.remove(log, 1)
    end
    for k, v in pairs(log) do
        text = text .. v
    end
end
-- end log logic

local function update_ui(self)
    if self.ad_type then
        if self.ad_type == admob.MSG_INTERSTITIAL then
            admob.is_interstitial_loaded()
        elseif self.ad_type == admob.MSG_REWARDED then
            admob.is_rewarded_loaded()
        elseif self.ad_type == admob.MSG_BANNER then
            admob.is_banner_loaded()
        end
    end
end

local function set_block_height(height)
    -- use banner height in gui
    local screen_width, screen_height = window.get_size()
    local settings_height = tonumber(sys.get_config("display.height"))
    local mult = screen_height/settings_height
    local height_b_node = gui.get_node("height_b")
    local size = gui.get_size(height_b_node)
    size.y = height/mult
    gui.set_size(height_b_node, size)
end

local function admob_callback(self, message_id, message)
    if message_id == admob.MSG_INITIALIZATION then
        self.initialized = true
        if message.event == admob.EVENT_COMPLETE then
            print("EVENT_COMPLETE: Initialization complete")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error "..message.error)
        end
    elseif message_id == admob.MSG_IDFA then
        if message.event == admob.EVENT_STATUS_AUTHORIZED then
            print("EVENT_STATUS_AUTHORIZED: ATTrackingManagerAuthorizationStatusAuthorized")
        elseif message.event == admob.EVENT_STATUS_DENIED then
            print("EVENT_STATUS_DENIED: ATTrackingManagerAuthorizationStatusDenied")
        elseif message.event == admob.EVENT_STATUS_NOT_DETERMINED then
            print("EVENT_STATUS_NOT_DETERMINED: ATTrackingManagerAuthorizationStatusNotDetermined")
        elseif message.event == admob.EVENT_STATUS_RESTRICTED then
            print("EVENT_STATUS_RESTRICTED: ATTrackingManagerAuthorizationStatusRestricted")
        elseif message.event == admob.EVENT_NOT_SUPPORTED then
            print("EVENT_NOT_SUPPORTED: IDFA request not supported on this platform or OS version")
        end
    elseif message_id == admob.MSG_INTERSTITIAL then
        if message.event == admob.EVENT_CLOSED then
            print("EVENT_CLOSED: Interstitial AD closed")
        elseif message.event == admob.EVENT_FAILED_TO_SHOW then
            print("EVENT_FAILED_TO_SHOW: Interstitial AD failed to show\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_OPENING then
            -- on android this event fire only when ADS activity closed =(
            print("EVENT_OPENING: Interstitial AD is opening")
        elseif message.event == admob.EVENT_FAILED_TO_LOAD then
            print("EVENT_FAILED_TO_LOAD: Interstitial AD failed to load\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_LOADED then
            print("EVENT_LOADED: Interstitial AD loaded")
            print("admob.show_interstitial()")      -- added
            admob.show_interstitial()      -- added
            msg.post("easy:/go#easygui", "interstitial_finished")
        elseif message.event == admob.EVENT_NOT_LOADED then
            print("EVENT_NOT_LOADED: can't call show_interstitial() before EVENT_LOADED\nError: "..message.error)
        elseif message.event == admob.EVENT_IMPRESSION_RECORDED then
            print("EVENT_IMPRESSION_RECORDED: Interstitial did record impression")
        elseif message.event == admob.EVENT_CLICKED then
            print("EVENT_CLICKED: Interstitial clicked")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error: "..message.error)
        end
    elseif message_id == admob.MSG_REWARDED then
        if message.event == admob.EVENT_CLOSED then
            print("EVENT_CLOSED: Rewarded AD closed")
        elseif message.event == admob.EVENT_FAILED_TO_SHOW then
            print("EVENT_FAILED_TO_SHOW: Rewarded AD failed to show\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_OPENING then
            -- on android this event fire only when ADS activity closed =(
            print("EVENT_OPENING: Rewarded AD is opening")
        elseif message.event == admob.EVENT_FAILED_TO_LOAD then
            print("EVENT_FAILED_TO_LOAD: Rewarded AD failed to load\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_LOADED then
            print("EVENT_LOADED: Rewarded AD loaded")
            print("admob.show_rewarded()") .       -- added
            admob.show_rewarded() .       -- added
            msg.post("easy:/go#easygui", "reward_finished")
        elseif message.event == admob.EVENT_NOT_LOADED then
            print("EVENT_NOT_LOADED: can't call show_rewarded() before EVENT_LOADED\nError: "..message.error)
        elseif message.event == admob.EVENT_EARNED_REWARD then
            print("EVENT_EARNED_REWARD: Reward: " .. tostring(message.amount) .. " " .. tostring(message.type))
        elseif message.event == admob.EVENT_IMPRESSION_RECORDED then
            print("EVENT_IMPRESSION_RECORDED: Rewarded did record impression")
        elseif message.event == admob.EVENT_CLICKED then
            print("EVENT_CLICKED: Rewarded clicked")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error: "..message.error)
        end
    elseif message_id == admob.MSG_BANNER then
        if message.event == admob.EVENT_LOADED then
            print("EVENT_LOADED: Banner AD loaded. Height: "..message.height.."px Width: "..message.width.."px")
            set_block_height(message.height)
            print("admob.show_banner( admob."..self.banner_positions[self.show_pos]..")")       -- added
            admob.show_banner(admob[self.banner_positions[self.show_pos]])       -- added
            self.show_pos = self.show_pos + 1       -- added
            if self.show_pos > #self.banner_positions then       -- added
                self.show_pos = 1       -- added
            end       -- added
            msg.post("easy:/go#easygui", "banner_finished")
        elseif message.event == admob.EVENT_OPENING then
            print("EVENT_OPENING: Banner AD is opening")
        elseif message.event == admob.EVENT_FAILED_TO_LOAD then
            print("EVENT_FAILED_TO_LOAD: Banner AD failed to load\nCode: "..message.code.."\nError: "..message.error)
        elseif message.event == admob.EVENT_CLICKED then
            print("EVENT_CLICKED: Banner AD clicked")
        elseif message.event == admob.EVENT_CLOSED then
            print("EVENT_CLOSED: Banner AD closed")
        elseif message.event == admob.EVENT_DESTROYED then
            print("EVENT_DESTROYED: Banner AD destroyed")
        elseif message.event == admob.EVENT_IMPRESSION_RECORDED then
            print("EVENT_IMPRESSION_RECORDED: Banner did record impression")
        elseif message.event == admob.EVENT_JSON_ERROR then
            print("EVENT_JSON_ERROR: Internal NE json error: "..message.error)
        end
    end
    update_ui(self)
end

function init(self)
    msg.post(".", "acquire_input_focus")

    local engine_info = sys.get_engine_info()
    self.is_debug = engine_info.is_debug

    if self.is_debug then
        if sys.get_sys_info().system_name == 'iPhone OS' then
            self.banner_ad_unit = "ca-app-pub-3940256099942544/2934735716" -- test unit for banners
            self.interstitial_ad_unit = "ca-app-pub-3940256099942544/4411468910" -- test unit for interstitial
            self.rewardedvideo_ad_unit = "ca-app-pub-3940256099942544/1712485313" -- test unit for rewarded
        else --Android
            self.banner_ad_unit = "ca-app-pub-3940256099942544/6300978111" -- test unit for banners
            self.interstitial_ad_unit = "ca-app-pub-3940256099942544/1033173712" -- test unit for interstitial
            self.rewardedvideo_ad_unit = "ca-app-pub-3940256099942544/5224354917" -- test unit for rewarded
        end
    else
        if sys.get_sys_info().system_name == 'iPhone OS' then
            self.banner_ad_unit = "xxxxxxx" -- real
            self.interstitial_ad_unit = "xxxxxxx" -- real
            self.rewardedvideo_ad_unit = "xxxxxxx" --  real
        else --Android
            self.banner_ad_unit = "xxxxxxx" --  real
            self.interstitial_ad_unit = "xxxxxxx" -- real
            self.rewardedvideo_ad_unit = "xxxxxxx" -- real
        end
    end

    self.show_pos = 1
    self.banner_positions = {
        "POS_BOTTOM_CENTER",
        "POS_BOTTOM_LEFT",
        "POS_BOTTOM_RIGHT",
        "POS_NONE",
        "POS_TOP_LEFT",
        "POS_TOP_CENTER",
        "POS_TOP_RIGHT",
        "POS_CENTER"
    }

    if admob then
        admob.set_callback(admob_callback)
        admob.set_privacy_settings(true)
    end
    update_ui(self)
end

function final(self)
    msg.post(".", "release_input_focus")
end

function on_message(self, message_id, message, sender)
    if not admob then
        return
    end

    local prev_type = self.ad_type

    if prev_type ~= self.ad_type then
        update_ui(self)
    end

    if message_id == hash("initialization_box") then
        self.initialized = true
        print("initialization_box DONE!")
        if message_id == hash("show_initialize") then
            print("admob.initialize()")
            admob.initialize()
        end
    end

    if message_id == hash("show_idfa") then
        print("admob.request_idfa()")
        admob.request_idfa()
    end

    if message_id == hash("show_reward") then
        self.ad_type = admob.MSG_REWARDED
        print("admob.load_rewarded()")
        admob.load_rewarded(self.rewardedvideo_ad_unit)
                -- removed
    end

    if message_id == hash("show_banner") then
        self.ad_type = admob.MSG_BANNER
        print("admob.load_banner()")
        admob.load_banner(self.banner_ad_unit)
                -- removed
    end

    if message_id == hash("show_interstitial") then
        self.ad_type = admob.MSG_INTERSTITIAL
        print("admob.load_interstitial()")
        admob.load_interstitial(self.interstitial_ad_unit)
                -- removed
    end

    if message_id == hash("show_inspector") then
        print("admob.show_ad_inspector()")
        admob.show_ad_inspector()
    end
end
AGulev commented 1 year ago

@robertnicjoo what version of defold you are using here, and what version of the adbob extension. Please add logs from your latest attempt.

If you have a crash, pls provide crashlog from logcat.

robertnicjoo commented 1 year ago

Defold 1.3.7 Admob 2.2.0

I'll try to run again and make logs for you.

AGulev commented 1 year ago

If you check the demo app (project in this repo) it works?

AGulev commented 1 year ago

@robertnicjoo could you pls take a look and answer my question?

robertnicjoo commented 1 year ago

@robertnicjoo could you pls take a look and answer my question?

Hi, Demo app works but problem in my case as far as I understood is switching between banner and reward ads.

Here is logic:

Load banner on screen (game level) load. And show rewards on game pause(when user lost) to give them extra life and again show banner on game continue.

The issue:

Issue is loading state cannot switch. Either must choose to have banner on level screen load or reward on pause menu and cannot have both at same screen.

Why demo app works then?

Demo app uses radio button to load each ads state individually and not automatically therefore switching is happening on show ads button.

britzl commented 1 year ago

@robertnicjoo I don't see how this is an issue in the extension itself but rather a logic error in the way the extension is used?

@AGulev do you agree?

AGulev commented 1 year ago

@britzl I don't see it's a problem in the test project I can show banner and then watch rewarded ads without any problems without hidding banner so I don't get what the problem is

robertnicjoo commented 1 year ago

@robertnicjoo I don't see how this is an issue in the extension itself but rather a logic error in the way the extension is used?

@AGulev do you agree?

I never said the extension has issue I said as far as I understood its not possible (could be issue could be not). if have any solution to my logic/issue please feel free to help.

@britzl I don't see it's a problem in the test project I can show banner and then watch rewarded ads without any problems without hidding banner so I don't get what the problem is

AGulev commented 1 year ago

I don't understand what it doesn't switch between banner on loaded screen and reward ads on pause menu means

Ads is a separate plugin, it doesn't know anything about screens or something like that. If banner loaded - you can show it. If rewarded is loaded - you can show it as well. So, in my game I show banner in a pause menu, then user can close this menu and watch rewarded ADS to get a tip.

The same in the example app you can load banner, show it, then swiwtch to something else and whow rewarded. Admob doesn't care if it's the same screen or not, it will work in any case.

Also there is no such thing as switching from banner to rewarded ads. You don't need to do anything with banner if you wanna show Rewarded ADS.

That's why I don't undersand it doesn't switch between banner on loaded screen and reward ads on pause menu and asked you to provide logs (preferably the same as logging I have in the example project) after changes you made. This will help me to see if you really call everething in the right order.

one more option will be providing an isolated project and repo-steps for it where I'll be able to reproduce the issue myself.

robertnicjoo commented 1 year ago

I will try to make your requested logs and will inform you by tomorrow. Thanks anyway.

AGulev commented 7 months ago

@robertnicjoo did you figure out what the problem was?

AGulev commented 7 months ago

no info provided