3

I am developing simple application using Ionic framework (and AngularJs) that fetches json data from my webpage. How can I detect is there "internet connection" and display message to user: "Connect to internet" if not.

EDIT

Can I use cordova API for that ?

0

2 Answers 2

5

Cordova provides org.apache.cordova.network-information plugin.

See documentation HERE

This plugin provides an implementation of an old version of the Network Information API. It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.

Sign up to request clarification or add additional context in comments.

1 Comment

Now use cordova plugin add cordova-plugin-network-information
3

If I am not mistaken, this plugin only detects whether the Wi-Fi or Cellular networking is enabled on the device. This does not always mean that the application can actually reach your remote server, if you are connected to the WiFi network without internet connection. Therefore, the only solution I have found to ensure that the application can reach your remote server is to continuously ping the server.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.