Revmob, Media ID, App ID, Placement ID, what?

Hei all,

I am trying to implement revmob and I am rying to show a rewarded video, without success at all. I think it might be because wrong App Id. I am confused, as I found here in the forums App Id and Placement Id, whereas in the Revmob dashboard I only can find a Media ID.

Here is my code:

local revmob = require( "plugin.revmob" ) local placementID = "What to put here?" local function adListener( event ) print("ad phase: " .. event.phase) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) elseif ( event.phase == "sessionStarted" ) then -- Successful initialization -- Load a RevMob ad revmob.load( "rewardedVideo", placementID ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) 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="576f1744ba2d1fde3bf9924e" } )

As appId I used the mediaID from an Ad that I created for Android in the Revmob Media panel. (Only testing on Android for now)…

When starting my App I get:

ad phase: init nil

And nothing more.

revmob.isLoaded( placementID ) is false afterwards.

For the placementID I used the Name of the Ad Unit for now, but I think I never arrive in the part of the code that would request the ad…

Any idea what could be wrong? (I used the daily build from today)

Best,

Felix

Hi Felix,

App Id and media Id are the same thing, you’re correct.

Placement Id is unique for each ad unit space. To get your placement Ids or create new ones, you should go to Revmob Media panel, click on your app’s name and scroll down. There you’ll see your “Ad Units”. Click on the “View” button of the ad unit you want to use (under “Actions” column) and you’ll find your placement Id right next to the On/off toggle.

We’ll soon refactor this to make it easier and more intuitive.

Let us know if you need any more help.

Best regards,

Hello sdk8,

thanks for your reply.

So to load a rewarded video I need to call:

revmob.load( "rewardedVideo", "Rewarded Video" )

Is this correct?

Is there a way to debug the revmob plugin? So I can figure out why never get a sessionStarted event?

Best,

Felix

Update.

I got it working. The trick is not to wait for the sessionStarted event (it never occurs). Instead, loading the ad when the init event was recieved worked and I could successfully show a video!

So my currently working code is

local revmob = require( "plugin.revmob" ) local placementID = "THIS\_IS\_THE\_AD\_UNIT" -- for example 'Rewarded Video' local function adListener( event ) print("ad phase: " .. event.phase) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) -- Load a RevMob ad revmob.load( "rewardedVideo", placementID ) elseif ( event.phase == "sessionStarted" ) then -- Successful initialization --never occured for me elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) 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="THIS\_IS\_THE\_MEDIA\_ID" } )

Maybe there shoul be a test for the event.isError variable before loading a video, and if true try to reinit the plugin, but for now this is a working example for me.

Maybe somebody from Corona could either update the Docs or explain when the sessionStarted event is fired and what to do with it.

Best,

FElix

Just in case anybody wonders why my forementioned code is not working, you need to check if event.isError is present before printing it. If it is nil, it seems to silently fail and stop the execution of the rest of the function.

Here is the code that is currently working for me:

local revmob = require( "plugin.revmob" ) local placementID = "THIS\_IS\_THE\_AD\_UNIT" -- for example 'Rewarded Video' local function adListener( event ) print("ad phase: " .. event.phase) if ( event.phase == "init" ) then -- Successful initialization if event.isError then print( event.isError ) else -- Load a RevMob ad revmob.load( "rewardedVideo", placementID ) end elseif ( event.phase == "sessionStarted" ) then -- Successful initialization --never occured for me elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) 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="THIS\_IS\_THE\_MEDIA\_ID" } )

Best,

Felix

Another update:

The code above only works on Android. On iOS I actually get the sessionStarted event.phase, but I also get some errors:

[RevMob] Starting RevMobAds

event phase: init

event phase: sessionStarted

–Now I try to load a rewardedVideo

Invalid Parameter: URL argument was malformed URL

[RevMob] Initializing Fullscreen.

[RevMob] Fail with error: unsupported URL

event phase: failed

event type: rewardedVideo

event isError: true

event.response: unsupported URL - Error Code -1002

Invalid Parameter: URL argument was malformed URL

Anybody has some ideia what could be wrong?

Thanks in advance,

Felix

How old is the revmob plugin?  I can’t get it to work at all on Android 4.0.4.

Hei davemikesell,

I dont know how old the plugin is. But it will only work on Android 4.1 or higher:

Note

For Android, video and rewarded video ads require version 4.1 or higher.

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

Best,

Felix

I’m not trying video, just banner and fullscreen.  The docs don’t show a version requirement for those.

I dont know this.

Maybe some corona staff could chip in to answer this question.

Did you try to use the code I posted above? (With changing the placement ID and the load ad call?

I tried a working sample from the other thread on this forum and it doesn’t work for me.

BTW, using Corona build 2906, the last public release.

Update:

Actually the information that I confirmed mor up in this thread is wrong!

The placementID is actually another, not “Rewarded Video” or something like this. In another thread I got an answer that shows the correct ID to use: (https://forums.coronalabs.com/topic/64564-revmob-on-ios-not-working-invalid-parameter-url-argument-was-malformed-url/#entry333793)

“I used to use the ID provided by Revmob dashboard. There should be an ID for each of the Ad unit of an App. Press the “eye” icon under “actions” of the “Ad Unit” to check.”

Thanks to wilsonwansun!!

Best,

Felix

ps. davemiksel, this might resolve your problem as well…

Thanks, but my problem is different.  I have all the correct ids, the ad just never loads.   I’m using the old Revmob.lua API at the moment and it’s working fine.   

You are correct.

You only specify the ad type when you load the ad.

When you go to show the ad, you pass the placement id. 

This is all covered in the plugin docs here: https://docs.coronalabs.com/daily/plugin/revmob/index.html

Thanks

Hei Danny,

yes, its written in the docs, but you use different terms and it took me some time to figure what is what…

Best,

Felix

Hello,

I work on Windows 10 for create an app for Andorid.

I implemented the Revmob plugin but sometimes it work only the first time, sometimes it not work.

At the end of each game I want to display an interstitial ad but, the revmob plugin, don’t display the ad.

It seems that the listener function, is not executed …

Could you please help me to solve this issue?

Thanks

Benedetto

My source:

local revmob = require( “plugin.revmob” )

local RevMob_PLACEMENT_IDS = “5107dfc2b90935a8030000a5”

local function revmobListener(event)

   if ( event.phase == “sessionStarted” ) then  – Successful initialization

        revmob.load( “interstitial”, RevMob_PLACEMENT_IDS )

    elseif ( event.phase == “loaded” ) then

– no actions for me

    elseif ( event.phase == “failed” ) then 

        print( event.type )

        print( event.isError )

        print( event.response )

        revmob.init( revmobListener, { appId=“573b786709ebdb8b27cdf48e” } )

    end

end

– Initialize RevMob

revmob.init( revmobListener, { appId=“573b786709ebdb8b27cdf48e” } )

function scene:hide( event )

        revmob.show( RevMob_PLACEMENT_IDS, { yAlign=“top” } )

        parent:newGame()

end

Hi Benedetto,

Is all of that code in main.lua? The last few lines look like they belong in a Composer scene. If it is in another module you have to make sure the variable RevMob_PLACEMENT_IDS is visible in that module.

Rob

Hi Rob,

​thanks for your reply.

Yes this is all my code for manage the revmob ads.
This code are in one module of composer scene (not in main.lua).
This module is launched at end of each game with composer.showOverlay(… from another module.

Before, I had on my project a revmob.lua module downloaded from revmob site, (name revmob-corona-sdk-5.5.1.zip) but now, this module don’t work correctly (close button don’t run and is not possible to close the ad without click in).

I tried to change this module (no new version of this module on revmob site) with your plugin but, with code attached above, the ad is displayed only the first time that this module is launched.
I inserted some native.showalert message in revmobListener function (the plugin don’t running on Corona Simulator for windows, my version is 2016.2830), builded the android apk, install the apk and these alerts are displayed only the first that the module is launched.

It seems that, after first launch, the revmobListener function is not executed.

Can I, “close” the revmob plugin (with which command) so, the next time that I run the command revmob.init the revmobListener function is re-executed?
Can this be a solution?

Thanks

Benedetto

Normally you call the .init() function once in main.lua and your listener function also is part of main.lua. Then in your overlay’s scene:show() you would call the revmob.show() function to show the ad.

Rob

Hi Rob,

I solved my problem.

Insert init() function and listener in main.lua and .load() and .show() function on composer module.

Now, the ads works perfectly.

Thanks for yor help.

Best regards

Benedetto