How do I check if the device is connected to internet

Get help using Construct 2

Post » Fri Dec 25, 2015 11:03 pm

Hi,

My game have interstitial ads that is shown in a specific moment of the game. But if the device is not connected to the internet the interstitial ads won't show. I would like to make sure that the device is connected to the internet, so it can load and show the interstitial ads. When there is no internet connection the game hangs trying to show the interstital. Is there a way to check if the device is connected? And if the device its not connected, is there a way to skip the interstitital and proceed with the game, without hanging? Thanks!
B
14
S
5
Posts: 110
Reputation: 1,338

Post » Sat Dec 26, 2015 12:48 am

If you could let me know what device you are referring to, a browser, a phone or such it would be alot easier.

With the browser object theres a 'is offline' action
B
8
S
2
Posts: 41
Reputation: 643

Post » Sat Dec 26, 2015 8:56 am

artbava wrote:Hi,

My game have interstitial ads that is shown in a specific moment of the game. But if the device is not connected to the internet the interstitial ads won't show. I would like to make sure that the device is connected to the internet, so it can load and show the interstitial ads. When there is no internet connection the game hangs trying to show the interstital. Is there a way to check if the device is connected? And if the device its not connected, is there a way to skip the interstitital and proceed with the game, without hanging? Thanks!


As covered in the Browser section of the manual:

If you have the Browser object in your project you can use the condition
Code: Select all
Is online
True if the browser currently has an active connection to the internet.


You could also try the expression
Code: Select all
ConnectionType
The type of connection technology in use if it is known. This can be "bluetooth", "cellular", "ethernet", "wifi", "wimax", "other", "unknown" or "none" (indicating offline mode).
If your vision so exceeds your ability, then look to something closer.
Moderator
B
129
S
29
G
77
Posts: 5,194
Reputation: 54,293

Post » Sat Dec 26, 2015 2:17 pm

Alydus,
Thanks and sorry, it is for mobile phones, tablets and desktop.

zenox98,
Thank you too. How can i use this ConnectionType, i can't see this on browser actions or conditions?

I really appreciated your help. I will use a browser event.
B
14
S
5
Posts: 110
Reputation: 1,338


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests