Saturday, May 18, 2024
HomeiOS Developmentswift - Sign power, CID, LAC, and many others.) on iOS for...

swift – Sign power, CID, LAC, and many others.) on iOS for an inside Flutter app


I’m growing an inside cell app in Flutter and must retrieve detailed mobile community data corresponding 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 by means of public APIs, however since this app is for inside use solely, I’m in search of any attainable answer.

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 degree: 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(
            degree: degree,
            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))
    }
}

Nevertheless, the output I get is:

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

As you possibly can see, most of the fields have placeholder values or incorrect knowledge.

Query:

How can I retrieve detailed mobile community data on iOS for an inside app? Are there any strategies, public or non-public APIs, or workarounds to get this knowledge, contemplating the app is not going to be distributed through the App Retailer?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments