Check if app is online


#1

Hi,

I’ve been trying to check if my ionic app is online. I’ve written a codepen here, with a working example. The problem is that if try to replicate this on my Nexus 5, it doesn’t work but keeps telling that the device is online even when I put it on fly mode. While if I emulate the app on ios with wi-if off it actually works.

Does anyone have an idea why?

Plus, any suggestion how to constantly check in background if the device is online in order to model some data fetching I’m performing?

Thanks,
Elia


#2

Problem solved, it was just a matter of using cordova: http://cordova.apache.org/docs/en/2.5.0/cordova_events_events.md.html#online

Thanks in any case.


#3

Hey glad to hear you resolved it!

The docs you were referencing are a bit older. The api shouldn’t have changed, but it’s always nice to know where to get the most up to date info. :smile:

http://plugins.cordova.io/#/package/org.apache.cordova.network-information


#4

Thanks for the newer ref :smile: