How to check if the device is connected to the internet? (Android ,iOS)

popugames

  • Posts: 54
I have a game that contains ads and i want to check every 30 seconds if the device is connected to the Internet

mdotedot

  • Posts: 1654
Hi Popugames,

You can use blocks that are in Stencyl to connect to a website-URL and set a isConnected=False outside of the visit block and inside set isConnected=true.
http://www.stencyl.com/help/viewArticle/123

Hope this helps.

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

popugames

  • Posts: 54
Can you give me an example ?
Thank you.

« Last Edit: January 18, 2015, 07:40:25 am by popugames »

TEDDD

  • *
  • Posts: 4
I checked what mdotedot wrote.
It works for me.
I did not expect that such an arrangement of blocks would be correct and would work. But it works:)

The first screen on top shows the detection of no internet connection.
The second screen on bottom, return to game, when the player is connected to the Internet.
Link to URL is randomly chosen by me

mg][/img]