I've integrated Vungle video ads in my Corona Game it was working perfect but few days ago it stopped caching video ads completely, but after few days it stared it self without changing any thing in code. Now it again stopped caching video ads. I suspect this issue is either from Corona or Vungle side but am not sure.
local vungleInterstitial = "540e9681c7ec2b6d4400000e"
local videoCompletedCallback=nil
videoAddListener=function( event )
if (event.isError ) then
--Cached video ad not available for display
print("problem to show ad")
elseif event.type == "cachedAdAvailable" then
print("cachedAdAvailable")
elseif tostring(event.type) == "adView" then
print("called when add is viewed")
elseif event.type == "adStart" then
print("Corona ads started")
audio.pause()
elseif event.type == "adEnd" then
print("Corona ads ended")
videoCompletedCallback()
audio.resume()
end
end
showVideoAd = function(callbackFunc)
print("showVideoAd function called")
videoCompletedCallback=callbackFunc;
if ( vads.isAdAvailable() ) then
print(" if ( vads.isAdAvailable() ) then, is true")
print("vads.show")
vads.show( "interstitial", { isBackButtonEnabled = false } )
else
local alert = native.showAlert( "Video Ad", "The Video Ad is not available at the moment. Please Try after some time.", { "OK" } )
end
end
vads.init("vungle",vungleInterstitial,videoAddListener)
This might be related to geo or daily view limits.. can you try with vungleTest as your AppID? Also, if you have further questions, feel free to email me at tech-support#vungle.com
Cheers,
Jordyn / Vungle
Related
So, I am making a game and it is almost done, however, the problem I am having is that when the player comes in contact with the bomb, it just kills the player and does not play any sound effect. It plays the sound effect when collecting items though. The collection for the items are set up the exact same. When I collect an item, it plays the sound effect, when I hit a bomb, it doest play anything. Just silence. Please help!
if firstBody.node?.name == "Player" && secondBody.node?.name == "Bomb" {
if sound == true {
self.run(SKAction.playSoundFileNamed("Bomb.mp3", waitForCompletion: false))
}
firstBody.node?.removeFromParent()
secondBody.node?.removeFromParent()
self.scene?.isPaused = true
playerDied()
}
Is there a way to suspend app from code? Just like pressing Win + arrow down on simulator. Some event maybe? I want to use it for debug only, so it has to work on simulator.
You just can "handling" the system events, but not suspend the app by code.
-- create a function to handle all of the system events
local onSystem = function( event )
if event.type == "applicationStart" then
print("start")
elseif event.type == "applicationExit" then
print("exit")
elseif event.type == "applicationSuspend" then
print("suspend")
elseif event.type == "applicationResume" then
print("resume")
end
end
-- setup a system event listener
Runtime:addEventListener( "system", onSystem )
I am trying to load an interstitial ad before actually showing it so that I can avoid lag. However everything I have tried has failed. With this code no ad ever appears:
local ads = require( "ads" )
ads.init( "admob", "ca-app-pub-2823622942892345/4361536298", adListener )
ads.load( "interstitial", { appId="ca-app-pub-2823622942892345/4361536298",
testMode=false } )
local function adListener( event )
if ( event.isError ) then
--Failed to receive an ad
else
ads.show( "interstitial", { x=0, y=0, appId="ca-app-pub-2823622942892345/4361536298" } )
end
end
With this code the ad loads but with lag...
local ads = require( "ads" )
ads.init( "admob", "ca-app-pub-2823622942892345/4361536298", adListener )
ads.load( "interstitial", { appId="ca-app-pub-2823622942892345/4361536298", testMode=false } )
ads.show( "interstitial", { x=0, y=0, appId="ca-app-pub-2823622942892345/4361536298" } )
Does anyone now why it does not work? If so how can I resolve it?
In your first example, your adListener function won't work. Since it's a local function and declared after you use it the first time, it will be nil on that first use. That function needs to be higher up in your code before it's used the first time.
In your second example, the ads.load() is an asynchronous call, that means we know it can take a while to work, so control returns to your app immediately and then you call ads.show() before the as has loaded and therefore nothing shows.
There is a tutorial that may help you with this:
http://coronalabs.com/blog/2014/07/15/tutorial-implementing-admob-v2/
How do i implement vungle in to corona sdk for only one scene. I followed the docs on corona site to implement vungle to my game. I implemented in only one scene of my game but it shows in every scene randomly, my question is how do i keep the vungle in only one scene.
I use also inmobi ads in game.
Here is the code i used.
I used this code in only one scene of my game.
local provider = "vungle"
local appId = "vungleTest"
local ads = require "ads"
local function adListener( event )
if event.type == "adStart" and event.isError then
-- cached video ad not available for display
end
end
ads.init( provider, appId, adListener )
local wasAdShown = ads.show( "interstitial", { isAnimated = false, isBackButtonEnabled = true } )
You didn't post all of your source so it's hard to tell the exact problem. It seems to me that you need to have some logic around the variable wasAdShown, also you might want to make it a global variable.
I would do something like this:
wasAdShown = false
if wasAdShown == false then
ads.show( "interstitial", { isAnimated = false, isBackButtonEnabled = true } )
wasAdShown = true
else
print "Ad Was Shown Already"
end
do it like this
if (ads.isAdAvailable()) then
local adShown = ads.show("interstitial", { isAnimated = false })
end
otherwise when ad get cached(loaded) it come to screen.
I have added full screen Ads in my application but when i click on the cross button on the full screen Ads to close the Ads page and simultaneously click on the Ads Page to open the test window it sometimes gives error message attempt to call method 'didRemoveListener' a nil value, i have added code what i am writing in my application below, Please help to sort out this problem, thanks...
local RevMob = require("revmob")
display.setStatusBar(display.HiddenStatusBar)
local fullscreen
local revmobListener
local storyboard = require "storyboard"
local REVMOB_IDS = {
["Android"] = "",
["iPhone OS"] = ""
}
RevMob.startSession(REVMOB_IDS)
RevMob.setTestingMode(RevMob.TEST_WITH_ADS)
local function ShowAds()
fullscreen.RevMob.createFullscreen()
RevMob.showFullscreen(revmobListener, REVMOB_IDS)
end
revmobListener=function(event)
if(event.type=="adClicked" then
fullscreen:hide()
storyboard.gotoScene("scenes.Scene1")
elseif event.type=="adClosed" then
fullscreen:hide()
storyboard.gotoScene("scenes.Scene1")
end
ShowAds()
A way to solve it. Just accept the first touch.
local clicked = false
revmobListener=function(event)
if(event.type=="adClicked" and not clicked then
fullscreen:hide()
storyboard.gotoScene("scenes.Scene1")
clicked = true
elseif event.type=="adClosed" and not clicked then
fullscreen:hide()
storyboard.gotoScene("scenes.Scene1")
clicked = true
end