Connection detection

72 views
Skip to first unread message

givp

unread,
Feb 24, 2009, 3:02:18 PM2/24/09
to phonegap
I'm really sorry to be posting this again since I can see it has been
discussed a few times here. Except I haven't been able to find an
answer.

My app was rejected from the App store because it does not alert the
user if they have no internet connection.

I'm guessing the best place is on the first view and if you have no
connection, it throws an alert saying so.

But how? Any advice would be awesome.

Thank you,
g

Jonathan

unread,
Feb 24, 2009, 3:04:54 PM2/24/09
to phonegap
How old is your version of phonegap that you downloaded? I think in
mid jan or early feb they added code to do this. I'll see if I can
look in my project to see what you need.

Adrian Goddard

unread,
Feb 24, 2009, 3:14:01 PM2/24/09
to phon...@googlegroups.com
Hi

As Jonathan states, i'm pretty sure newer builds cater for this but
not 100%

Way back when.. I think what i did a bit of a hack, that basically
made a request for an image off a server, set a timer and if it didn't
get the image down in x amount of time then i deemed a lack of
connection:) Hacky I know and cant find my project now but it got me
accepted at the time:)

Also navigator.onLine is supported on the later releases of safari on
the iphone, 2.1 onwards if memory serves. Not going to work for
everyone but more robust than the hack:)

ade

givp

unread,
Feb 24, 2009, 4:16:55 PM2/24/09
to phonegap
I downloaded the latest build last week.

g

reverend

unread,
Feb 25, 2009, 10:41:46 AM2/25/09
to phonegap
Heh, that's exactly what my Blok-Buster app does, Adrian. I agree
it's a bit of a hack, but Apple accepted it. I'd love to see what
code was added recently that gives you a better solution...

Alshie

unread,
Mar 27, 2009, 9:08:07 AM3/27/09
to phonegap
I'm using the navigator.onLine method as mentioned by Adrian:

function checkNetwork(){
if(navigator.onLine == false){
alert("Error: No internet Connection");
}
}

$(document).ready(function() {
checkNetwork();
});
Reply all
Reply to author
Forward
0 new messages