I need help with rewarded video

I’m a little frustrated because I just published my first game on Google Play and after almost a year of testing with the “test mode = true” of the Appodeal plugin without any error now my code does not detect the “playBackEnded” with the “test mode = false”

You know how frustrating it is for my players to see an ad and not receive anything  :( 

I really don’t know where to start asking the questions so I will try to be brief but I know it will be a long explanation. I will appreciate the patience of those who want to help me.

I have a module called ads.lua with several functions.

listener & init() & rewarded video function:

-- Ad listener function M.adsListener = function( event )   -- Successful initialization of the Appodeal plugin   if ( event.phase == "init" ) then     print( "Appodeal event: initialization successful" )       -- An ad loaded successfully   elseif ( event.phase == "loaded" ) then     print( "Appodeal event: ad loaded successfully" )     print( event.type )   -- The ad was displayed   elseif ( event.phase == "displayed" ) then     print( "Appodeal event: ad displayed" )     print( event.type )   -- The ad was played   elseif ( event.phase == "playbackBegan" ) then     print( "Appodeal event: ad playback Began" )     print( event.type )   -- The ad was closed/hidden   elseif ( event.phase == "hidden" or event.phase == "closed" ) then     print( "Appodeal event: ad closed/hidden" )     print( event.type )   -- The ad was closed/hidden   elseif ( event.phase == "playbackEnded" ) then     print( "Appodeal event: ad playback Ended" )     print( event.type )         loads.numOfLives  = 6     loads.heartStatus = 0     loads.updateGameProgress()   -- The user clicked/tapped an ad   elseif ( event.phase == "clicked" ) then     print( "Appodeal event: ad clicked/tapped" )     print( event.type )   -- The ad failed to load   elseif ( event.phase == "failed" ) then     print( "Appodeal event: ad failed to load" )     print( event.type )     print( event.isError )     print( event.response )   end end

-- initialize ad plugin function M.startAdsPlugin = function( event )   appodeal.init( M.adsListener, {     appKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",     testMode = false,    childDirectedTreatment = false,     disableWriteExternalPermissionCheck = false,     supportedAdTypes = {"interstitial", "rewardedVideo"},     hasUserConsent = (gameSettings.userConsent or false),        disableNetworks =     {       "amazon\_ads",       "facebook",       "flurry",       "my\_target",       "mintegral",       "ogury",       "yandex",       "mopub"     }   } ) end -- show rewarded video ad function M.showRewardedVideoAd = function( event )   print( "--Start to show rewarded video ad--" )   if ( appodeal.isLoaded( "rewardedVideo" ) ) then     appodeal.show( "rewardedVideo" )   end   print( "--Ad shown--" ) end

In the game there is a heart that when filled allows me to refill lives if the player see a rewarded video. I start the Appodeal plugin in the main.lua requiring the ads module and executing the function ads.startAdsPlugin().  When the player has one life left I open an overlay scene with a question if you want to see a

rewarded video to refill lives and continue the game.  Everything works perfectly with the “test mode = true”.  the nightmare

began with the “test mode = false”.

build settings:

-- -- For more information on build.settings, see the Project Build Settings guide at: -- https://docs.coronalabs.com/guide/distribution/buildSettings -- settings = { &nbsp;orientation = &nbsp;{ &nbsp;&nbsp;-- Supported values for orientation: &nbsp;&nbsp;-- portrait, portraitUpsideDown, landscapeLeft, landscapeRight &nbsp;&nbsp;default = "portrait", &nbsp;&nbsp;supported = { "portrait", }, &nbsp;}, &nbsp;-- &nbsp;-- Android section &nbsp;-- &nbsp;android = &nbsp;{ &nbsp;&nbsp;usesPermissions = &nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;"android.permission.INTERNET", &nbsp;&nbsp;&nbsp;"android.permission.ACCESS\_NETWORK\_STATE", &nbsp;&nbsp;&nbsp;"android.permission.WRITE\_EXTERNAL\_STORAGE", &nbsp;&nbsp;&nbsp;"android.permission.GET\_ACCOUNTS", &nbsp;&nbsp;&nbsp;"android.permission.ACCESS\_COARSE\_LOCATION", &nbsp;&nbsp;&nbsp;"android.permission.ACCESS\_FINE\_LOCATION", &nbsp;&nbsp;}, &nbsp;&nbsp;applicationChildElements = &nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;[[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<meta-data android:name="com.google.android.gms.ads.APPLICATION\_ID" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;android:value="xx-xxx-xxx-xxxxxxxxxxxxxxxx~xxxxxxxxxx"/\> &nbsp;&nbsp;&nbsp;&nbsp;]], &nbsp;&nbsp;}, &nbsp;}, &nbsp;-- &nbsp;-- iOS section &nbsp;-- &nbsp;iphone = &nbsp;{ &nbsp;&nbsp;xcassets = "Images.xcassets", &nbsp;&nbsp;plist = &nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;UIStatusBarHidden = false, &nbsp;&nbsp;&nbsp;UILaunchStoryboardName = "LaunchScreen", &nbsp;&nbsp;&nbsp;NSAppTransportSecurity = { NSAllowsArbitraryLoads=true }, &nbsp;&nbsp;}, &nbsp;}, &nbsp;-- &nbsp;-- Plugins &nbsp;-- &nbsp;plugins = &nbsp; { &nbsp;&nbsp;&nbsp; -- Base &nbsp;&nbsp;['plugin.appodeal.beta.base']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;-- Interstitial & Rewarded Video &nbsp;&nbsp;['plugin.appodeal.beta.GoogleAdMob']&nbsp;&nbsp;&nbsp;&nbsp;= { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.AdColony']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.StartApp']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.AppLovin']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.Chartboost']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.Vungle']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.Unity']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.IronSource']&nbsp;&nbsp;&nbsp;&nbsp; = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.InMobi']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.Tapjoy']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;['plugin.appodeal.beta.Appnext']&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Needs account to be use with Appodeal - Best used for analytics &nbsp;&nbsp;--['plugin.appodeal.beta.Flurry'] = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Needs account to be use with Appodeal &nbsp;&nbsp;--['plugin.appodeal.beta.FacebookAudience'] = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Mobvista renamed to Mintegral = "mintegral" &nbsp;&nbsp;--['plugin.appodeal.beta.Mobvista'] = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Mailru renamed to MyTarget = "my\_target" &nbsp;&nbsp;--['plugin.appodeal.beta.MyTarget'] = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;--['plugin.appodeal.beta.AmazonAds'] = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;--['plugin.appodeal.beta.Ogury'] = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;--['plugin.appodeal.beta.Yandex'] = { publisherId = 'com.coronalabs' }, &nbsp;&nbsp;--['plugin.appodeal.beta.TwitterMoPub'] = { publisherId = 'com.coronalabs' }, &nbsp; }, &nbsp;-- &nbsp;-- Project section &nbsp;-- &nbsp;excludeFiles = &nbsp;{ &nbsp;&nbsp;-- Exclude unnecessary files for each platform &nbsp;&nbsp;all = { "Icon.png", "Icon-\*dpi.png", "Images.xcassets", }, &nbsp;&nbsp;android = { "LaunchScreen.storyboardc", }, &nbsp;}, }

I would like to know if I am doing something wrong. I know it must be difficult to understand what 'm doing here but I think there must be an error where the “playBackEnded” is not recognized with the

"test mode = false"

Any help is welcome!

DoDi

I checked two apps that I know the rewards ads are working with Appodeal.

First one was updated 3 weeks ago:

if event.data ~= nil and event.type == "rewardedVideo" and event.data.finished == true and event.phase == "closed" then -- Reward here.

the second one is a little older and closer to your code and this I believe still works in my app with an older version of appodeal:

if event.data ~= nil and event.type == "rewardedVideo" and event.data.name == "reward" and event.phase == "playbackEnded" then -- Give reward here.

Thanks @agramonte for your quick response. It was really helpful. You have made me think differently. Thanks again. I will implement what you suggest and test the results.

@agramonte I have 2 questions I have no data on any server, or in appodeal, the application configuration in appodeal apps does not require anything about sending data to the event.

Why do I need to verify event.data?

Also event.phase = “closed” Indicates that an ad has been closed. It only applies to interstitial and video static ads, not rewards.

Why do I need to verify this phase?

My game only shows interstitial ads (static and video) and a rewarded video. Can you show an example of what my listener looks like?

Thanks in advance
DoDi

This is just what I do for my apps. It took me weeks of testing to come up with something that reliably will provide a status that the reward ad was completed. You might have a more simple way.  I’ll try to share my library tomorrow when I have more time.