Check internet on Api calling

I want to check if internet is available when calling an api in the app

1 Like

if(navigator.onLine) // returns true

First we should check internet connection is true or not.Then next line call Api in the same function.But this is true or not. I don’t know. Please try it

How we check internet connection is true or false?

1 Like

Here i have attached my sample application refer coding.where you want to use this coding paste it,Try it.This is Ionic v3.https://github.com/Karthikaivel/Inertnetcheck