Accurately reading of iPhone signal strength

I’m playing with this function and I’ve noticed you’re calling it in an interesting way. I’m calling it by adding CoreTelephony.framework as a compile-time link. For the function itself, you’ll want to declare it’s prototype somewhere (perhaps immediately above the method you call from):

int CTGetSignalStrength();

This needs to be declared since it isn’t in a public header for CoreTelephony.

Now, I built a simple app that prints signal strength every second.

int CTGetSignalStrength();

- (void)viewDidLoad
{
    [super viewDidLoad];

    while (true) {
        printf("signal strength: %d\n", CTGetSignalStrength());
        sleep(1);
    }
}

I ran it on my iPad mini and it shows steady values until I picked it up, where the number went up. Wrapping my iPad in tin foil (tin foil is a debugging tool I have never used before) caused the number to go down. When I put my iPad in airplane mode, it kept repeating the last value, so this will not be an accurate measure for you.

If you want to test if a device currently has a cellular data network connection, you may be more interested in Reachability, specifically kSCNetworkReachabilityFlagsIsWWAN.

Leave a Comment