I am creating web application for gear s2 watch with anjularJS. My code is as follows:
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
setTimeout(function(){
if (!navigator.onLine) {
alert("Error");
}
else
{
$http.get("customers.php").then(function(response) {
alert("Success");
});
}
}, 5000);
});
</script>
This code will call customers.php every 5 seconds and that works fine when I conneced to my paired phone and display Success message. As soon as I disconnected from phone it will display Error message that is also fine because it is not connected to network, But when app is in running state and watch is again connected to phone then also it is showing Error message.
Am I need to wake-up the network someway if yes let me know how?
Please help me.
Thanks..