Monitoring Internet access before loading webmap

550
3
09-26-2012 09:36 AM
JohnMcleod1
New Contributor III
Hello all,
Does anyone know where I can find a sample project where a ViewController is monitoring access to the Internet?
I have three mapViews (different ViewControllers) and I wish to alert user as to no Internet access.
All the examples I've found just check for the status of "Reachability".  I have implemented such examples within my project but once network or Internet access is cut off, the app does not act as the "cut off" has happened.  A restart is necessary.

Thanks for any help with this,

John
0 Kudos
3 Replies
JohnMcleod1
New Contributor III
This is the code I use to check for Internet access.

- (int)checkForInternetConnection: (Reachability*) curReach {
    
    Reachability *reachability = [Reachability reachabilityForInternetConnection];
    NetworkStatus internetStatus = [reachability currentReachabilityStatus];
    NSLog(@"Reachability changed: %u", internetStatus);
    
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"No Internet Connection!"
                                         message:@"This feature requires an Internet connection via WiFi or cellular network to work properly."
                                         delegate:nil
                                         cancelButtonTitle:@"OK"
                                         otherButtonTitles:nil];
        [alertView show];
        [alertView release];
}


John
0 Kudos
JohnMcleod1
New Contributor III
This must be a difficult subject.

Here's where I am.

I can get a UIAlertView to appear when the network or Internet is disconnected.:D
My problem is when the Internet access is reestablished, the webmap will not refresh or reload.:(

John
0 Kudos
NimeshJarecha
Esri Regular Contributor
You'll have to reopen webmap into mapView.

Regards,
Nimesh
0 Kudos