Wifi / Cellular Data Bandwidth in iOS

I wanted to know the signal strength in dBm in iOS 13 Swift. I went through most of the forum related to getting network signal streanth in iOS but none of them is working correctly


I tried using NetworkExtension but it is returning nil value


NEHotspotHelper.supportedNetworkInterfaces


I tried using statusbar, but it is crashing



let app = UIApplication.shared

var rssi: Int?

guard let statusBar = app.value(forKey: "statusBar") as? UIView, let foregroundView = statusBar.value(forKey: "foregroundView") as? UIView else {

return rssi

}

for view in foregroundView.subviews {

if let statusBarDataNetworkItemView = NSClassFromString("UIStatusBarDataNetworkItemView"), view .isKind(of: statusBarDataNetworkItemView) {

if let val = view.value(forKey: "wifiStrengthRaw") as? Int {

//print("rssi: \(val)")

rssi = val

break

}

}

}

return rssi


I tried using CTTelephonyNetworkInfo, but there is no option to get the dbm value.


I wanted to know the mobile data usage (singal strength) . Once the mobile data (singal strength) goes down, my application should stop the process.

I would like to find the network traffic. There is TrafficStats.class in Android to know the transmission and receive byte in mobile. Is there any iOS API to know transmission and receive byte

I wanted to know the signal strength in dBm in iOS 13 Swift.

There is no supported way for a general-purpose app to get Wi-Fi or cellular signal strengths.

I went through most of the forum related to getting network signal [strength] in iOS but none of them is working correctly

Right. Historically the iOS sandbox had security holes that let folks hack their way into getting this info. Those have now been closed.

What’s your high-level goal here?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

@eskimo, Thanks for your valuable feedback. I am using webrtc video call in my application. If mobile data (wifi / cellular bandwidth) goes down, the ios application should terminate the webrtc video call instead of call disconnect abrubtly. For this requirement, i do have threshold bandwidth value, once mobile data (wifi/cellular badwidth) reaches threshold value, app will alert the user and terminate the call.

If mobile data (wifi / cellular bandwidth) goes down

Right, but signal strength is a very poor way to estimate the available bandwidth. For example, if the cell is horribly congested you might have great signal strength but very poor bandwidth.

A better approach is to measure action network throughput. See this post for my general take on this.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Wifi / Cellular Data Bandwidth in iOS
 
 
Q