Supersonic ad Integration for Corona

I am integrating supersonic with my game built in corona. I dont see ads being displayed. anything wrong with my integration?

 

local supersonic = require( “plugin.supersonic” )

supersonic.init( adListener, { appKey=“XXXXX” } )

        supersonic.load( “rewardedVideo” )

       supersonic.show( event.type )

 

Build file below. Please help me integrate

 

 

 

– Supported values for orientation:

– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

settings = {

orientation = {

default = “portrait”,

supported = { “portrait” }

},

           android =

    {

    facebookAppId = “XXXXXXXXXX” ,

googlePlayGamesAppId = “XXXXXXXXX” ,

            

        usesPermissions =

        {

            “com.android.vending.BILLING”,

            “com.android.vending.CHECK_LICENSE”,

            “android.permission.INTERNET”,

   “android.permission.INTERNET”,

            “android.permission.ACCESS_NETWORK_STATE”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

             

        },

    },

    plugins = {

    

  [“plugin.supersonic”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, android=true }

        },

           

                       

    

        [“plugin.facebook.v4”] =

{

publisherId = “com.coronalabs”,

},

        [“plugin.google.iap.v3”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { android=true }

        },

                

        

             

        [“plugin.google.play.services”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { android = true }

        },

         

         [“CoronaProvider.native.popup.social”] =

        {

            publisherId = “com.coronalabs”

        },

        [“CoronaProvider.gameNetwork.google”] =

      {

      

      publisherId = “com.coronalabs”,

   },

    

     

        [“plugin.advertisingId”] =

       {

publisherId = “com.coronalabs”

       },

    

   },

    

    

}

Hello @desiventure6. First when posting code the forums, please click on the blue <> button in the edit bar (along with Bold, Italic, etc) and paste your code into the window that opens. It will make it much easier for us to see your code. You should do this for each code snippet so we can tell whats in one file and what’s in another.

Are you getting any error messages in your console window?

What version of Corona SDK are you using?

What device are you testing on?

Can we see the code for your event listener?

Thanks

Rob

Thanks Rob for ur Reply

  1. I am testing on android device

  2. It is a 3 month old Corona free version. I ll give you the exact version number in sometime

  3. I am not using any event listeners i am directly calling init, load, show as given below. 

    local supersonic = require( “plugin.supersonic” ) supersonic.init( adListener, { appKey=“XXXXX” } ) supersonic.load( “rewardedVideo” ) supersonic.show( “rewardedVideo” )

  4. Build file as given below

    – Supported values for orientation: – portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = “portrait”, supported = { “portrait” } }, android = { facebookAppId = “XXXXXXXXXX” , googlePlayGamesAppId = “XXXXXXXXX” , usesPermissions = { “com.android.vending.BILLING”, “com.android.vending.CHECK_LICENSE”, “android.permission.INTERNET”, “android.permission.INTERNET”, “android.permission.ACCESS_NETWORK_STATE”, “android.permission.WRITE_EXTERNAL_STORAGE”, }, }, plugins = { [“plugin.supersonic”] = { publisherId = “com.coronalabs”, supportedPlatforms = { iphone=true, android=true } }, [“plugin.facebook.v4”] = { publisherId = “com.coronalabs”, }, [“plugin.google.iap.v3”] = { publisherId = “com.coronalabs”, supportedPlatforms = { android=true } }, [“plugin.google.play.services”] = { publisherId = “com.coronalabs”, supportedPlatforms = { android = true } }, [“CoronaProvider.native.popup.social”] = { publisherId = “com.coronalabs” }, [“CoronaProvider.gameNetwork.google”] = { publisherId = “com.coronalabs”, }, [“plugin.advertisingId”] = { publisherId = “com.coronalabs” }, }, }

First you should use a listener function. You’re passing the address of a function in anyway. The listener is important because it lets you look for errors. More importantly it lets you know when an ad is loaded.

supersonic.load() and supersonic.show() are asynchronous functions. That means that supersonic.load() queues up a request for an add and immediately returns before the ad is loaded. This is to prevent your app from pausing while slow operations take place. The result is that supersonic.show() is called immediately before the ad is loaded and is failing.

Had you implemented the listener function and used if statements to check for errors and print messages when errors were received, you would know exactly what’s going on. Also a common practice is to actually call supersonic.show() from inside the listener function after you get a successful acknowledgement that the ad was loaded.

But because video, rewarded and interstitial ads can take time to load, many people decouple the loading and showing process and will maybe load the ad at the beginning of a scene and then at the end of the scene call .show(). You can always use the .isLoaded() check to make sure the ad is loaded before showing it:

if supersonic.isLoaded() then &nbsp;&nbsp;&nbsp;&nbsp; supersonic.show() end

But you have to give time for .load() to finish regardless of showing the ad once the load is done or later if you’ve decoupled the loading and showing process.

Rob

Hi Rob,

I used listener event function. I have kept conditions and it seems to initialize fine but it is not loading. 

so supersonic.load( “rewardedVideo” ) is not loading ads and it is not going into the loop. Anything wrong with the way i ve loaded?

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Load an offer wall ad supersonic.load( "rewardedVideo" ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded -- Show the ad supersonic.show( event.type ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end

put some print statements in there.  Drop:

print( json.prettify( event ) )

just inside the function and see what events  you’re getting. You will of course need to require the json module at the top of your main.lua

Rob

i printed event.type and after initiation its value becomes init

After load it still remains in init. nothing in loaded.

may be i am loading it wrong? 

What device are you testing on?

Are there any messages in your console log? If you’re using “adb logcat” (for Android) make sure you’re not passing any other parameters to adb logcat.

Sorry Rob.  I dont have any seperate testing portal. I test directly in my android device.

i just give print statements wherever needed. If u happen to have sample code in git hub do share… i ll check how it works and try my sdk key in the same sample.

I don’t believe we have a sample app for this. It’s pretty straight forward.

How are you installing the app on your device?

Rob

Hello @desiventure6. First when posting code the forums, please click on the blue <> button in the edit bar (along with Bold, Italic, etc) and paste your code into the window that opens. It will make it much easier for us to see your code. You should do this for each code snippet so we can tell whats in one file and what’s in another.

Are you getting any error messages in your console window?

What version of Corona SDK are you using?

What device are you testing on?

Can we see the code for your event listener?

Thanks

Rob

Thanks Rob for ur Reply

  1. I am testing on android device

  2. It is a 3 month old Corona free version. I ll give you the exact version number in sometime

  3. I am not using any event listeners i am directly calling init, load, show as given below. 

    local supersonic = require( “plugin.supersonic” ) supersonic.init( adListener, { appKey=“XXXXX” } ) supersonic.load( “rewardedVideo” ) supersonic.show( “rewardedVideo” )

  4. Build file as given below

    – Supported values for orientation: – portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = “portrait”, supported = { “portrait” } }, android = { facebookAppId = “XXXXXXXXXX” , googlePlayGamesAppId = “XXXXXXXXX” , usesPermissions = { “com.android.vending.BILLING”, “com.android.vending.CHECK_LICENSE”, “android.permission.INTERNET”, “android.permission.INTERNET”, “android.permission.ACCESS_NETWORK_STATE”, “android.permission.WRITE_EXTERNAL_STORAGE”, }, }, plugins = { [“plugin.supersonic”] = { publisherId = “com.coronalabs”, supportedPlatforms = { iphone=true, android=true } }, [“plugin.facebook.v4”] = { publisherId = “com.coronalabs”, }, [“plugin.google.iap.v3”] = { publisherId = “com.coronalabs”, supportedPlatforms = { android=true } }, [“plugin.google.play.services”] = { publisherId = “com.coronalabs”, supportedPlatforms = { android = true } }, [“CoronaProvider.native.popup.social”] = { publisherId = “com.coronalabs” }, [“CoronaProvider.gameNetwork.google”] = { publisherId = “com.coronalabs”, }, [“plugin.advertisingId”] = { publisherId = “com.coronalabs” }, }, }

First you should use a listener function. You’re passing the address of a function in anyway. The listener is important because it lets you look for errors. More importantly it lets you know when an ad is loaded.

supersonic.load() and supersonic.show() are asynchronous functions. That means that supersonic.load() queues up a request for an add and immediately returns before the ad is loaded. This is to prevent your app from pausing while slow operations take place. The result is that supersonic.show() is called immediately before the ad is loaded and is failing.

Had you implemented the listener function and used if statements to check for errors and print messages when errors were received, you would know exactly what’s going on. Also a common practice is to actually call supersonic.show() from inside the listener function after you get a successful acknowledgement that the ad was loaded.

But because video, rewarded and interstitial ads can take time to load, many people decouple the loading and showing process and will maybe load the ad at the beginning of a scene and then at the end of the scene call .show(). You can always use the .isLoaded() check to make sure the ad is loaded before showing it:

if supersonic.isLoaded() then &nbsp;&nbsp;&nbsp;&nbsp; supersonic.show() end

But you have to give time for .load() to finish regardless of showing the ad once the load is done or later if you’ve decoupled the loading and showing process.

Rob

Hi Rob,

I used listener event function. I have kept conditions and it seems to initialize fine but it is not loading. 

so supersonic.load( “rewardedVideo” ) is not loading ads and it is not going into the loop. Anything wrong with the way i ve loaded?

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Load an offer wall ad supersonic.load( "rewardedVideo" ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded -- Show the ad supersonic.show( event.type ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end

put some print statements in there.  Drop:

print( json.prettify( event ) )

just inside the function and see what events  you’re getting. You will of course need to require the json module at the top of your main.lua

Rob

i printed event.type and after initiation its value becomes init

After load it still remains in init. nothing in loaded.

may be i am loading it wrong? 

What device are you testing on?

Are there any messages in your console log? If you’re using “adb logcat” (for Android) make sure you’re not passing any other parameters to adb logcat.

Sorry Rob.  I dont have any seperate testing portal. I test directly in my android device.

i just give print statements wherever needed. If u happen to have sample code in git hub do share… i ll check how it works and try my sdk key in the same sample.

I don’t believe we have a sample app for this. It’s pretty straight forward.

How are you installing the app on your device?

Rob