How to get Apps Using WLAN & Cellular Setting setting status in the picture below ?
How can I check that status(None, WLAN, WLAN&Cellular) for my App, so that I can show an alert to remind user of open this switch ~

When Reachability is NotReachable, there are 2 situation ,
Apps Using WLAN & Cellular Setting
is offIf we can get the SSID of current wifi, we can judge that the wifi is connected and the network switch is off ~
#import <SystemConfiguration/CaptiveNetwork.h>
BOOL networkSwitchOff = NO;
Reachability *reach = [Reachability reachabilityForInternetConnection];
NetworkStatus status = [reach currentReachabilityStatus];
if(status==NotReachable){ //Reachability NotReachable
NSArray *supportedInterfaces = (__bridge_transfer id)CNCopySupportedInterfaces();
id info = nil;
NSString *ssid = nil;
for (NSString *networkInfo in supportedInterfaces) {
info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)networkInfo);
if (info && [info count])
break;
}
if (info) {
NSDictionary *dctySSID = (NSDictionary *)info;
//we can't get ssid if wifi is not connected
ssid = [dctySSID objectForKey:@"SSID"];
}
networkSwitchOff = (ssid!=nil);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With