almost 10 years ago
Hi Guys,
You can use this function before hitting any server api. This will check whether your device is connected to network or not.
+ (BOOL)isNetworkAvailble{ const char *host_name = "google.com"; BOOL _isDataSourceAvailable = NO; Boolean success; //Creates a reachability reference to the specified //network host or node name. SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL,host_name); //Determines if the specified network target is reachable //using the current network configuration. SCNetworkReachabilityFlags flags; success = SCNetworkReachabilityGetFlags(reachability, &flags); _isDataSourceAvailable = success && (flags & kSCNetworkFlagsReachable) && !(flags & kSCNetworkFlagsConnectionRequired); CFRelease(reachability); if (!_isDataSourceAvailable) { [self showAlertMessage:ALERT_NETWORK_ERROR]; } return _isDataSourceAvailable; }
Thanks
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)