Alternative to CoreTelephony for Accessing Cellular Network Information in Private iOS App

Hello,

I am developing a private internal Flutter app for our customer, which will not be published on the Apple Store. One of the key features of this app is to collect RF strength metrics to share user experience with the network.

For Android, we successfully implemented the required functionality and are able to collect the following metrics:

Signal strength level (0-4)
Signal strength in dBm
RSSI
RSRQ
Cell ID
Location Area Code
Carrier name
Mobile country code
Mobile network code
Radio access technology
Connection status
Duplex mode

However, for iOS, we are facing challenges with CoreTelephony, which is not returning the necessary data. We are aware that CoreTelephony is deprecated and are looking for alternatives.

We noticed that a lot of the information we need is available via FTMInternal-4. Is there a way to access this data for a private app? Are there any other recommended approaches or frameworks that can be used to gather cellular network information on iOS for an app that won't be distributed via the Apple Store?

my swift code

import Foundation
import CoreTelephony

class RfSignalStrengthImpl: RfSignalStrengthApi {
    func getCellularSignalStrength(completion: @escaping (Result<CellularSignalStrength, Error>) -> Void) {
        let networkInfo = CTTelephonyNetworkInfo()

        guard let carrier = networkInfo.serviceSubscriberCellularProviders?.values.first else {
            completion(.failure(NSError(domain: "com.xxxx.yyyy", code: 0, userInfo: [NSLocalizedDescriptionKey: "Carrier not found"])))
            return
        }

        let carrierName = carrier.carrierName ?? "Unknown"
        let mobileCountryCode = carrier.mobileCountryCode ?? "Unknown"
        let mobileNetworkCode = carrier.mobileNetworkCode ?? "Unknown"
        let radioAccessTechnology = networkInfo.serviceCurrentRadioAccessTechnology?.values.first ?? "Unknown"

        var connectionStatus = "Unknown"
      ...
      ...
}

Thank you for your assistance.

Answered by Scott in 788168022

Can MetricKit support collecting these specific metrics at such frequent intervals?

Unfortunately that iOS Network Signal Strength post already calls out MetricKit as an approach that won’t help. Note that MXCellularConditionMetric contains only a single property (see histogrammedCellularConditionTime at link) which is basically a crude bar chart of signal strengths aggregated over the 24-hour reporting period. There’s no API to get at the underlying data points or timestamps, and note this metric deals in signal bars rather than actual dBm units.

I'm curious about how such an [internal Apple] app might collect data that is otherwise inaccessible through public APIs.

Apple’s built-in apps can use whatever private APIs they want, and in many cases the OS has the means to allow access to such APIs by only specific apps (i.e. theirs or carrier apps) that are entitled to do so. For the specific case of accessing low level telephony data, the restriction was added as a security fix way back in iOS version 8.3 or so. So even if you had the secret header files or documentation, the code wouldn’t actually work without your app having that special entitlement which will never be available.

is there any leeway or additional tools available for private/internal applications to gather more detailed cellular metrics?

Nothing that would be documented by Apple or suitable for discussion on this forum.

which will not be published on the Apple Store.

I wanna be clear that this doesn’t change things. DevForums is focused on the APIs in Apple’s various platfrom SDKs.

collect the following metrics

On iOS there’s no supported way to get real-time, low-level information from the cellular interface.

Regarding signal strength specifically, my iOS Network Signal Strength post covers that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@eskimo Thank you for your prompt response and the helpful guidance.

As a new developer in the Swift and Apple ecosystem, I'm finding my way through these APIs and trying to understand their capabilities and limitations. Your blog post on iOS Network Signal Strength has been enlightening, but I still have some questions and concerns.

MetricKit Capabilities: In my app, I need to collect metrics every 10 seconds, such as signal strength in dBm, RSSI, RSRQ, and Cell ID. My initial exploration of MetricKit, specifically MXCellularConditionMetric, hasn't yielded much information or examples online. Can MetricKit support collecting these specific metrics at such frequent intervals?

FTMInternal-4: I came across a reference to an internal Apple app named "FTMInternal-4" ( * 3001#12345# * ) that apparently has access to extensive network cell information. While I understand that using private APIs is not recommended and can lead to issues, I'm curious about how such an app might collect data that is otherwise inaccessible through public APIs. Is there a way to understand the capabilities of such internal tools without violating Apple's guidelines?

General Guidance for Private Apps: Given that this app is for internal use and will not be published on the App Store, is there any leeway or additional tools available for private/internal applications to gather more detailed cellular metrics?

Again, thank you for your assistance. Your support is invaluable as I navigate this new territory.

Accepted Answer

Can MetricKit support collecting these specific metrics at such frequent intervals?

Unfortunately that iOS Network Signal Strength post already calls out MetricKit as an approach that won’t help. Note that MXCellularConditionMetric contains only a single property (see histogrammedCellularConditionTime at link) which is basically a crude bar chart of signal strengths aggregated over the 24-hour reporting period. There’s no API to get at the underlying data points or timestamps, and note this metric deals in signal bars rather than actual dBm units.

I'm curious about how such an [internal Apple] app might collect data that is otherwise inaccessible through public APIs.

Apple’s built-in apps can use whatever private APIs they want, and in many cases the OS has the means to allow access to such APIs by only specific apps (i.e. theirs or carrier apps) that are entitled to do so. For the specific case of accessing low level telephony data, the restriction was added as a security fix way back in iOS version 8.3 or so. So even if you had the secret header files or documentation, the code wouldn’t actually work without your app having that special entitlement which will never be available.

is there any leeway or additional tools available for private/internal applications to gather more detailed cellular metrics?

Nothing that would be documented by Apple or suitable for discussion on this forum.

What Scott said plus…

I take issue with the term private API because, by definition, an API is public [1]. From an app developer’s perspective, what we’re talking about here are implementation details, and you shouldn’t write code that relies on such implementation details.

That’s true regardless of whether there are technical restrictions in place to prevent you from doing that.

As to how those technical restrictions work, iOS apps run in a sandbox. That sandbox is designed to prevent apps from accessing information that they’re not entitled to access. There are two primary mechanism that control what an app is entitled to access:

  • The user, via the various options in Settings > Privacy & Security

  • Code signing entitlements, which must be authorised by a provisioning profile

I talk about the latter extensively in TN3125 Inside Code Signing: Provisioning Profiles.

And that brings is to this comment from iOS Network Signal Strength:

If you’re working for a carrier, discuss your requirements with your carrier’s contact at Apple.

Carrier apps can use entitlements that get them access to more stuff. However, as that stuff isn’t in the iOS SDK, it’s not something we can discuss here on DevForums.

Finally, if you find a way around these restrictions — that is, you find a way to access information that your app is not entitled to access — that is, by definition, a serious bug in the iOS sandbox.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Internally Apple uses the term system programming interface (SPI) for stuff that’s expected to be called by other components within the system.

Alternative to CoreTelephony for Accessing Cellular Network Information in Private iOS App
 
 
Q