Fire a event when device is online and offline or internet connect and disconnect
5:20 PM
You can easily identify and fire a event or call a function when your device internet connect or disconnect, the function will automatically called. Modify your app.js as below (write this code into
$ionicPlatform.ready function
):
document.addEventListener("online", function(){
// fun(); this will call when device connect to internet
}, false);
document.addEventListener("offline", function(){
// fun(); this will call when device disconnect to internet
}, false);
0 comments