swift – Sign power, CID, LAC, and so forth.) on iOS for an inner Flutter app


I’m growing an inner cellular app in Flutter and must retrieve detailed mobile community data equivalent to sign power (dBm), cell ID (CID), location space code (LAC), and extra on iOS. I perceive that iOS restricts entry to a few of this data via public APIs, however since this app is for inner use solely, I’m on the lookout for any doable resolution.

Right here is the Swift code I’m utilizing to get community data:

import Basis
import CoreTelephony

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

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

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

        var connectionStatus = "Unknown"
        if let radioTech = networkInfo.currentRadioAccessTechnology {
            swap radioTech {
            case CTRadioAccessTechnologyGPRS:
                connectionStatus = "GPRS"
            case CTRadioAccessTechnologyEdge:
                connectionStatus = "EDGE"
            case CTRadioAccessTechnologyCDMA1x:
                connectionStatus = "CDMA1x"
            case CTRadioAccessTechnologyCDMAEVDORev0:
                connectionStatus = "EvDo Rev. 0"
            case CTRadioAccessTechnologyCDMAEVDORevA:
                connectionStatus = "EvDo Rev. A"
            case CTRadioAccessTechnologyHSDPA:
                connectionStatus = "HSDPA"
            case CTRadioAccessTechnologyHSUPA:
                connectionStatus = "HSUPA"
            case CTRadioAccessTechnologyLTE:
                connectionStatus = "LTE"
            default:
                connectionStatus = "Unknown"
            }
        }

        let duplexMode = "Unknown"
        let stage: Int64 = -1
        let dbm: Int64 = -1
        let rssi: Int64 = -1
        let rsrq: Int64 = -1

        let cid: Int64 = -1
        let lac: Int64 = -1

        let response = CellularSignalStrength(
            stage: stage,
            dbm: dbm,
            rssi: rssi,
            rsrq: rsrq,
            cid: cid,
            lac: lac,
            carrierName: carrierName,
            mobileCountryCode: mobileCountryCode,
            mobileNetworkCode: mobileNetworkCode,
            radioAccessTechnology: radioAccessTechnology,
            connectionStatus: connectionStatus,
            duplexMode: duplexMode
        )
        completion(.success(response))
    }
}

Nonetheless, the output I get is:

{
    stage: -1,
    dbm: -1,
    rssi: -1,
    rsrq: -1,
    cid: -1,
    lac: -1,
    carrierName: --,
    mobileCountryCode: 65535,
    mobileNetworkCode: 65535,
    radioAccessTechnology: CTRadioAccessTechnologyLTE,
    connectionStatus: LTE,
    duplexMode: Unknown
}

As you’ll be able to see, most of the fields have placeholder values or incorrect information.

Query:

How can I retrieve detailed mobile community data on iOS for an inner app? Are there any strategies, public or non-public APIs, or workarounds to get this information, contemplating the app won’t be distributed by way of the App Retailer?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles