Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

What is the proper way to implement KIDOZ ad when using composer for scene management?
Started by sheikhameen123 Jun 24 2019 08:09 AM

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sheikhameen123

[GLOBAL: userInfoPane.html]
sheikhameen123
  • Observer

  • 23 posts
  • Corona SDK

So this is what I did:

 

In my build.settings file, I added this:

-- Plugins section
--
plugins =
{
        ["plugin.kidoz"] =
        {
            publisherId = "com.coronalabs"
        },
},

And this is what I added to my main.lua:

I declared variable kidoz as global.

kidoz = require( "plugin.kidoz" )
 
function adListener( event )
    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )
    end
end
 
-- Initialize the KIDOZ plugin
kidoz.init( adListener, { publisherID="#####", securityToken="abcdefghigklmnop" } )

(publisherID and securityToken concealed for some good reasons..)

 

And this in the scene:create function of the scene I want the ad to be displayed:

kidoz.load( "interstitial" )

And added this code in the "did" phase of the scene:show function of the scene I want the ad to be displayed:

kidoz.show( "interstitial" )

And this in the "did" phase of the scene:hide function:

kidoz.hide( "interstitial" )

__________________________________________

 

So that's what I did.

When run on pc, the console says:

 

kidoz.init() WARNING: The KIDOZ plugin is only supported on Android & iOS devices. Please build for device
 
kidoz.load() WARNING: The KIDOZ plugin is only supported on Android & iOS devices. Please build for device
 
kidoz.show() WARNING: The KIDOZ plugin is only supported on Android & iOS devices. Please build for device
 
So I built for android, and got it into my phone that runs the latest version of android, android pie.
The game works fine. But the ad doesn't show up. Waited 10 mins on the scene. Still no response.
Help..


[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,788 posts
  • Enterprise

You will never see ads on the Corona simulator because the plugins are for mobile devices only.

 

You must put code in your .init()'s listener function to print the values of the event table if you're to see any errors from the upstream ad provider. It's the only way you can get information about what's going on. You will need to be able to view your device's console messages. Most people will do this with a tool named "adb" (you can Google it) or you might be able to with Android Studio with your device plugged in to your development computer via it's USB cable.

 

For ads in general, this tutorial is useful:

 

http://docs.coronalabs.com/tutorial/basics/ads/index.html

 

Rob




[topic_controls]
[/topic_controls]