Hello everybody,
There is still no fix for this issue so I thought I will share the workaround I implemented with you.
Please be advised this is no real fix but merely a safeguard to help prevent cheaters from bypassing your reward video from Appodeal.
For details and explanation, please see information below code snippet…
[lua]
local hadOpenEvt = false
local rVideoDone = false
local rVideoTS = 0
local minVideoT = 8 – min time outside app to NOT be detected as bypass (in seconds)
local function onSystemEvent( event )
if (event.type == “applicationOpen”) then
hadOpenEvt = true
end
end
local function appodealListener( event )
– Appodeal listener
if (phase == “playbackBegan” and event.type == “rewardedVideo”) then
rVideoTS = os.time() – app suspended while ad playing so system.getTimer won’t work
elseif (phase == “playbackEnded” and event.type == “rewardedVideo”) then
local difTime = os.difftime( os.time(), rVideoTS )
if (not hadOpenEvt or difTime > minVideoT) then
– No bypass detected, we’re cool
rVideoDone = true
else
print(“Cheater detected !!”)
end
elseif (phase == “closed”) then
– R.video
if (event.type == “rewardedVideo”) then
if (rVideoDone) then
– Reward genuinely earned by player, reset state
rVideoDone = false
hadOpenEvt = false
else
print(“Nice try, cheater !!”)
end
end
end
end
local function showRewardVideo()
if ( appodeal.isLoaded(“rewardedVideo”) ) then
hadOpenEvt = false
appodeal.show( “rewardedVideo” )
end
end
Runtime:addEventListener( “system”, onSystemEvent)
[/lua]
Ok, so few specifics here:
-
For bypassing ads, user will press home button on Android then re-open app clicking its icon
-
When app is put in background and re-opened this way, the system event ‘applicationOpen’ will fire on Android
-
If this happen while playing reward video, the flag ‘hadOpenEvt’ will be set to true
-
On ‘playback end’ event, we check its value and the time the user spent in suspended state.
If the time is long enough (see ‘minVideoT’), we consider it is not an effective bypass.
This will help prevent false positive as user might suspend app for genuine reasons.
Note: this can be removed for a stricter detection
That’s it, hope this will help some fellow game developers improving their game experience.
I still hope that Corona/Appodeal teams will put some time to resolve this very unfortunate bug.
In the meantime, this might do it for you guys !