android - Cordova Ionic App - check for the internet connection -
i've completed newsreader app, works => hurray, apart internet checks. when device not connected internet, app doesn't notify user fact.
i have internet check working, want connect every single request, app doesn't break if connection go down while using it.
i kind of new async way of doing things in ionic, , have straight question: there way make sure device connected internet before executing request? believe me, i've tried interceptors, , can't seem work.
the idea this: if app finds out, device not connected internet (wi-fi turned off, or mobile data turned off, whole extent of internet check), uses $ionicpopup
notify user. 2 buttons: "refresh", "close". upon clicking "refresh", internet check performed again, until connection on. during time, request held. clicking "close" closes dialog , request gets rejected (.reject()
).
a perfect solution while()
loop , blocking $ionicpopup
, $ionicpopup
love asynchronous. dang it.
any ideas? i'm sure it's peanuts experienced angular dev. thanks!
Comments
Post a Comment