B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

Online and Offline event not fired when application start

Hello,

how to check internet connection when application start?..
i put alert('I am online') in online event and alert('I am offline') in offline event

but it does not fired when application started ..except I manually set airplane mode on and off.

please help

thanks

Galyna Abramovych
Site Admin
Posts: 84
Joined: Tue Mar 22, 2016 6:03 pm

Online and Offline event not fired when application start

Hello,

To monitor your internet connectivity once the app is started, try using the JS below for that:
code
document.addEventListener("offline", function (){
alert('offline');
}, false);
document.addEventListener("online", function(){
alert('online');
}, false);
/code
Please look at this documentation for more information:
https://cordova.apache.org/docs/en/1....

Also, these links can be useful:
https://getsatisfaction.com/apperyio/...
https://getsatisfaction.com/apperyio/...

B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

Online and Offline event not fired when application start

where should I put thouse JS?..
I tried to put them in DeviceReady but it does not triggered..

I tried to set Airplane mode before I start the app.. but "offline" doesnot triggered

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Online and Offline event not fired when application start

Please check the connection with a "Cordova Network Information" plugin. Here is an example how to use it:
https://cordova.apache.org/docs/en/la...

Return to “Issues”