Reputation: 181
Is there a way to get the iPhone's carrier, and/or the current signal strength, using Objective-C? I know how to determine if a data connection is present, and whether or not that connection is wi-fi vs. cellular. I also know that you can manually place the iPhone into "field test" mode by going to the phone app, and dialing #3001*12345*# and hitting Send.
Upvotes: 7
Views: 5126
Reputation: 10104
This probably won't pass Apple's review, but you can use CTTelephony notifications. First, link against CTTelephony. Now just use this:
static void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { CFShow(name) NSString *sName = name; if ([sName isEqualToString:@"kCTIndicatorsSignalStrengthNotification"]) { if (userInfo) CFShow(userInfo); } }
And this to subscribe:
id ct = CTTelephonyCenterGetDefault(); CTTelephonyCenterAddObserver( ct, NULL, callback, NULL, NULL, NULL);
Upvotes: 2
Reputation: 2574
You made me curious and I found out that it's actually *3001#12345#*
(hashes and stars exchanged).
Upvotes: 3