Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Fuse Ad Listener not getting called?
Started by sakib.farid Nov 18 2015 12:25 PM

5 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sakib.farid

[GLOBAL: userInfoPane.html]
sakib.farid
  • Observer

  • 27 posts
  • Corona SDK

Hi

 

I am having problems with the fuse ad listener getting called at any of the event phases.

 

I have the following code with some native alerts to debug...

function fuseAdListener( event )
    native.showAlert( 'title', "Fuse Listener" )

    if ( event.isError ) then
        native.showAlert( 'title', "Fuse error: " .. event.response )
    else
        if ( event.phase == "init" ) then
            -- Fuse system initialized; load/cache a zone-specific ad
            fuse.load()

        elseif ( event.phase == "shown" ) then
            -- An ad finished showing
            native.showAlert( 'title', "Fuse Ad shown" )

        elseif ( event.phase == "completed" ) then
            -- User accepted an offer or completed a task for a reward
            -- The event.payload table contains details about the reward
            native.showAlert( 'title', event.payload.itemID )

            if event.type == "rewarded" then
                -- do some stuff
            end
        end
    end
end

fuse.init( fuseAdListener )

Thanks

 



[TOPIC: post.html]
#2

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @sakib.farid,

What else do you do following .init()? Can you show some code where the ad listener should be called? Also, does your code ever reach the listener function in any instance, i.e. do you ever see the first native alert for ( 'title', "Fuse Listener" )?

 

Brent



[TOPIC: post.html]
#3

sakib.farid

[GLOBAL: userInfoPane.html]
sakib.farid
  • Observer

  • 27 posts
  • Corona SDK

Hi Brent

 

So things seem to be working a little better :)

The code seems to be getting into the completed phase of the listener but I dont see

native.showAlert( 'title', event.payload.itemID )

Maybe because it is a number and the native alert requires a string ?



[TOPIC: post.html]
#4

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi again,

Yes, that is very likely. Try using print() statements for debugging instead, or convert the value to a string before passing it to the native alert.

 

Brent



[TOPIC: post.html]
#5

sakib.farid

[GLOBAL: userInfoPane.html]
sakib.farid
  • Observer

  • 27 posts
  • Corona SDK

Hi

 

So after a little more debugging it turns out that the docs at 

https://docs.coronalabs.com/plugin/fuse/event/adsRequest/payload.html 

which say the payload for a rewarded video should have an itemID property are incorrect.

 

The property in the payload is rewardItemId.

 

So to access the item id you would need event.payload.rewardItemId



[TOPIC: post.html]
#6

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Thanks @sakib.farid,

I'll update the docs soon to reflect the correct property name.

 

Brent




[topic_controls]
[/topic_controls]