Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining when an EDGE connection comes back after a dropout on an iPhone

I've incorporated Apple's Reachability sample into my own project so I know whether or not I have a network connection - if I don't have a network connection, I don't bother sending out and requests. I decided to go with the status notification implementation because it seemed easier to have the reachablity updated in the background and have the current results available immediately as opposed to kicking off a synchronous request whenever I want to make a network connection.

My problem is that I start getting false negatives when on an EDGE network - the phone has connectivity, but the app thinks this isn't the case. My understanding is you don't get a notification when an EDGE connection, so my assumption is that I lost and regained the connection at some point. Restarting the app is usually sufficient to see the network connection.

This isn't an optimal solution, so I was wondering if anybody else came across this problem and had any thoughts on a solutions.

(I don't know whether this applies to 3G as well; I'm running a first gen iPhone).

like image 435
Jablair Avatar asked Oct 08 '08 05:10

Jablair


People also ask

How to fix iPhone Wi-Fi keeps dropping connection?

When it has, though, you'll have to re-establish those network connections. Go back to Settings one more time and choose Wi-Fi. Pick the right network that appears and enter its password. Thereafter, your iPhone should have no more problems dropping the connection.

Why does my iPhone keep disconnecting from the Internet?

It boils down to making your iPhone completely forget all of its network connections. You could, instead, try going to Settings , Wi-FI and then tapping the i button next to your network. When you tap that, you go to a new page that has Forget This Network at the top.

How long does it take for edge to drop out?

Edge drops out after 1 few seconds - every other browser works most of the time. Trying to sort it is a pain as Microsoft require you to sign up to some community or other tell me that my username is already taken - probably by me. It then tries to open Edge to sort out the problem but of course Edge then drops out.

Why does my iPhone keep switching back to 4G cell?

If your iPhone keeps switching back to 4G cell when you know you're on a Wi-Fi network, this is what you need to do. Maybe you're lucky or maybe you have such a good cell signal everywhere that you've not noticed. For some reason, though, iPhones under iOS 12 can be prone to dropping their connection to a Wi-Fi network.


2 Answers

Reachability notificataions didn't seem to be reliable for me either, for detecting Wi-Fi. So I just use polling instead. Checking every 5 seconds seems to do no harm.

- (void) checkReachability {
    BOOL connected = ([[Reachability sharedReachability] localWiFiConnectionStatus] == ReachableViaWiFiNetwork);

    // Do something...

    [self performSelector:@selector(checkReachability) withObject:nil afterDelay:5.0];
}
like image 81
Chris Lundie Avatar answered Oct 16 '22 17:10

Chris Lundie


There is a nice reachability example on the net. it works wonderfully well: http://servin.com/iphone/iPhone-Network-Status.html

But you see, when I try to use it my own way, it just bombs.

Tried to implement it using:

NSString *sCellNetwork;     
 NSString *sNetworkReachable;  

if (flags & kSCNetworkFlagsReachable || flags & kSCNetworkReachabilityFlagsIsWWAN)

{do it} 

 else {
   Network fail alert; 
}
like image 30
Abhijeet Avatar answered Oct 16 '22 16:10

Abhijeet