Revmob plugin not working

Hello, I’m trying to make sense of revmob plugin. The apps are in test mode, but I get no banners shown neither on IOS nor on Android.
Build settings plugins and permissions

plugins = { ["plugin.revmob"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, }

Here I try to load banner ad

 

local revmob = require( "plugin.revmob" ) local placementID = "xxxxxxxxxxxxxxxxxxxx" local app = "xxxxxxxxxxxxxxxxxxx" if system.getInfo( "platform" ) == 'android' then   placementID = "xxxxxxxxxxxxxxxxxxxx"   app = "xxxxxxxxxxxxxxxxxxxxx" end local function adListener( event ) if ( event.phase == "sessionStarted" ) then -- Successful initialization -- Load a RevMob ad revmob.load( "banner", placementID ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) -- Show the ad revmob.show( placementID, { yAlign="bottom" } ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end -- Initialize RevMob revmob.init( adListener, { appId=app } ) revmob.startSession()

I’m getting this in adb logcat:
RevMob: RevMob did not answer as expected. (400)

Any ideas why this does not work?

Hi @patso,

According to the RevMob docs, you don’t need to call “startSession()” except on (perhaps) an “applicationResume” system event. Calling “init()” starts a session automatically.

https://docs.coronalabs.com/plugin/revmob/init.html

Also, try putting a condition in your if-then block for checking an “event.phase” of “init” and testing that you get a response from it.

Best regards,

Brent

Thanks, but it did not help.

I added this:

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print("initial initialization") print( event.type ) print( event.isError ) print( event.response ) end end

logcat gives me this

I/Corona (13939): initial initialization I/Corona (13939): nil I/Corona (13939): nil I/Corona (13939): nil

Hi @patso,

At a quick look, that look to be what I would expect to appear. The “init” phase does not provide an “event.type” (that is only related to the ad type that would show via another RevMob call).

Basically, it appears that the plugin is initializing properly. My next advice is to test your “sessionStarted” phase conditional block. Can you add a similar “print()” statement there and report what you see in the logcat?

Brent

THe same result

 

elseif (event.phase == "sessionStarted") then print("initial session") print( event.type ) print( event.isError ) print( event.response )

gives this:
 

I/Corona (27400): initial session I/Corona (27400): nil I/Corona (27400): nil I/Corona (27400): nil

The code posted below works. I have never used “sessionStarted” event.

local revmob = require( "plugin.revmob" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization revmob.load( "banner", "\<placementId\>" ) print( event.isError ) elseif ( event.phase == "loaded" ) then revmob.show( "\<placementId\>", { yAlign="top" } ) end end -- Initialize RevMob revmob.init( adListener, { appId="\<appId\>" } )

I tried that code, but the result is still the same. For some reason  RevMob does not answer as expected.

Hi @patso,

According to the RevMob docs, you don’t need to call “startSession()” except on (perhaps) an “applicationResume” system event. Calling “init()” starts a session automatically.

https://docs.coronalabs.com/plugin/revmob/init.html

Also, try putting a condition in your if-then block for checking an “event.phase” of “init” and testing that you get a response from it.

Best regards,

Brent

Thanks, but it did not help.

I added this:

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print("initial initialization") print( event.type ) print( event.isError ) print( event.response ) end end

logcat gives me this

I/Corona (13939): initial initialization I/Corona (13939): nil I/Corona (13939): nil I/Corona (13939): nil

Hi @patso,

At a quick look, that look to be what I would expect to appear. The “init” phase does not provide an “event.type” (that is only related to the ad type that would show via another RevMob call).

Basically, it appears that the plugin is initializing properly. My next advice is to test your “sessionStarted” phase conditional block. Can you add a similar “print()” statement there and report what you see in the logcat?

Brent

THe same result

 

elseif (event.phase == "sessionStarted") then print("initial session") print( event.type ) print( event.isError ) print( event.response )

gives this:
 

I/Corona (27400): initial session I/Corona (27400): nil I/Corona (27400): nil I/Corona (27400): nil

The code posted below works. I have never used “sessionStarted” event.

local revmob = require( "plugin.revmob" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization revmob.load( "banner", "\<placementId\>" ) print( event.isError ) elseif ( event.phase == "loaded" ) then revmob.show( "\<placementId\>", { yAlign="top" } ) end end -- Initialize RevMob revmob.init( adListener, { appId="\<appId\>" } )

I tried that code, but the result is still the same. For some reason  RevMob does not answer as expected.