Connect the esp8266 to the wireless network

For the IoT you can use a cheap esp8266 microcontroller with WiFi onboard. To connect the esp8266 to the wireless network you can use the following lua snippet that will work with the nodemcu firmware.

After connecting to the internet, you can create a TCP/IP server or client to send and receive data from your esp8266 microcontroller.

How to check if wifi is connected in android

If you want to try downloading something unless you have wifi. You can use the following code snippet to be able to check if wifi is enabled.

You will be able to use the ConnectivityManager to get the state of the Wifi adapter. From there you canĀ check if it is connected or even available.

Note: Add

to your AndroidManifest.xml for this to work.