How can I validate the internet connection


#1

Hello everyone, I want to make an app that brings some data from the server, how can I verify that the cell phone has an internet connection in an effective way?

The question is why sometimes the device appears connected to the network but can not navigate

Thank you


#2

If device is connected to a network but not internet, there is no direct api to validate that.

May be you can hit a website, could be google or your own server and see if that fails then you don’t have internet.


#3

thanks for the answer, it can be a good option, is there any fuuncion, method or api that allows to see if the wifi is active?

It would be to validate that first and then review it by connecting to a server.

Thank you


#4

Use https://docs.nativescript.org/ns-framework-modules/connectivity to check if a network is active.