How to check if device is LTE, 3G, HSPA or Wi-Fi?
-
02-07-2021 - |
Domanda
Is it possible to determine which kind of network is on the device when the user is interacting with my app?
Right now I have the Reachability class and I can differentiate between Wi-Fi and Cellular, but how to check if the Cellular is LTE, 3G, HSPA, EDGE?
Soluzione
As of iOS7, information about the cellular connection is available using CTTelephonyNetworkInfo():
let info = CTTelephonyNetworkInfo()
print(“carrierName": " + "\(info.subscriberCellularProvider?.carrierName ?? "Has not been configured for carrier")")
print(“currentRadioAccessTechnology: " + "\(info.currentRadioAccessTechnology ?? "Airplane Mode/No cell connection")")
currentRadioAccessTechnology will show a string that describes the type of connection.
Altri suggerimenti
There is currently no way to differentiate between different types of cellular network.
See this question for some further information.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow