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