Check internet connection?

Hi guys,
I am making a game and wanted to know if there is a way that i can(my game app) can check or know if the user has access to internet.
Actually i want my game to be running only when user has internet access and show a error screen saying connect to a network first if he/she dont have internet?

1 Like

An easy way would be to try to “Send a Request to a Web Page” to a server on the Internet. If you are able to receive data then the user is connected. The server can either be yours or a public one. Mind you that this action is ‘blocking’ until either data or an error occurs.

well i m aware of that trick but it wont work like that, if user get connection and start my game he will get in but after that he can go offline and can still continue playing the game and at that point i cant do that thing which i did at the start

Look at this extension from Maury:

It does just what you want for you.

2 Likes

how to use this extension???

2 Likes

You can download the extension I made here
https://drive.google.com/file/d/1H_P_Xg-76YMX3u-isOrQriAGC_Xh3xiU/view?usp=drivesdk

1 Like

Can u tell me how to do this please…m new…so

If you are new, I invite you to read how to add an extension to GDevelop.

I also invite you to see the main page of the Wiki which will redirect you to what you want to do and learn.
See the link of wiki on top of this forum.

I close this old topic.

1 Like