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.
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.