Ok guys I’ve decided to let each player play his way, thank you for your advices. So as not to cause confusion in my game I thought about making a brief internet signal verification. If you have an active signal, you can use the reward video button if not you can’t. In this way I let the player know that the button requires internet connection to watch the video and get the reward. But I have doubts because I have never handled a network request.
This is the code:
local networkConnection = true local function networkListener( event ) if ( event.isError ) then print( "Network error: ", event.response ) networkConnection = false else print ( "RESPONSE: " .. event.response ) networkConnection = true end end local function checkInternetConnection( event ) network.request( "https://encrypted.google.com", "GET", networkListener, {timeout = 3} ) end
I plan to do this in each scene: show. This way I can enable and disable the object:addEventListener() in each level according to the connection that the user has.
I’m worried that I do not know if I should cancel the network request at some point because I do not want the user use too much data. Already the ads use a lot of data. And I would not like to miss the opportunity to show ads because any connection fails, Ex. the player temporarily passes through an area with little coverage.