Check Internet Connection In Corona SDK

Why Check The User’s Internet Connection?

There are many reasons why you’d want to check your user’s internet connection status in Corona SDK. The most obvious reason would be if you were going to perform an action such as loading a web page or an advertisement. It would have a negative impact on the user to display a blank webpage in your app because the user had no internet connectivity, wouldn’t you agree? It’s much more professional to check for a connection first, then either alert the user that internet connectivity is required or simply enable offline mode in your app.

So today we’re going to fix that! I’ve written a simple function in the form of an external library that you can add to your project to quickly check your user’s internet connection!

Download the Library

Download (376B)

Usage Tutorial

  1. Unzip the file and place the testconnection.lua file in your project’s directory.
  2. Include the library in your project by placingconnection = require("testconnection") in the file you wish you test the connection in.
  3. Simply use if (connection.test()) then to test for internet connection!

In Conclusion

I hope this can help you speed up your development in Corona SDK! I know it’s a simple function, but it’s very useful if your project requires internet connectivity! Leave me a comment below if you have any problems or need help using it in your project.

Incoming search terms:

  • online level editor corona sdk
  • corona sdk lua optimization
  • corona sdk html
  • 4d play store icons