Checking Network Connectivity in ionic

Hi guys I am building a internet related application, and in that application I want to be able to check for connectivity status.
What I’m trying to implement is when a user opens up my app… In the main page the app should check if internet connectivity is available… if available then app will work like its supposed to…but if network connectivity is not present, then the user should be able to see a toast message or an alert to notify him, there is no internet connection

I tried the cordova native network plugin but for some reason I’m not able to install it :

I dont have any preference towards plugins or some other methods… I just want to implement the above function in the app. Please help.

You could put a heartbeat function on your server, like the connected “database location” in Firebase. If you don’t have a server, you’ll have to decide what you want to talk to, to see whether you can communicate.