Hi,
I know there are quite a few threads about this topic and I get that there is no way to do this without using private APIs but still, I'm in the need to ask it myself to get evidence for the company I work for.
I'm building a speed test app (iOS with Swift) to try to meassure the quality of mobile and wifi internet services. One of my requirements is to display the signal strength of the phone's mobile network/wifi network.
- Is there a way to measure or get signal strength from a wifi connection or a mobile connection?
- Is there an iOS version in which this is or was allowed?
- Is there any public API to get this information form?
- Is there any way to get permission from Apple or some kind of entitlement to allow us to get it?
- My boss found an app called OpenSignal that displays the signal strength of the mobile connection. That means there is a way to do it and get approved by the app store?
I found that you can get the signal strength via StatusBar with this function:
private func getSignal(isWifi:Bool) {
var classNameForStatusBar = ""
var valueForSignalValue = ""
if(isWifi) {
classNameForStatusBar = "UIStatusBarDataNetworkItemView"
valueForSignalValue = "wifiStrengthBars"
}
else {
classNameForStatusBar = "UIStatusBarSignalStrengthItemView"
valueForSignalValue = "signalStrengthRaw"
}
let app = UIApplication.sharedApplication()
let subViews = app.valueForKey("statusBar")?.valueForKey("foregroundView")?.subviews
var dataNetworkItemView:UIView?
if (subViews == nil) { return }
for subview in subViews! {
if (subview.isKindOfClass(NSClassFromString(classNameForStatusBar)!)) {
dataNetworkItemView = subview;
break
}
}
let signal = dataNetworkItemView?.valueForKey(valueForSignalValue)
print(signal)
}
On a similar thread (from June 2016), with a similar solution, an Apple staff member said it's not allowed (https://forums.developer.apple.com/message/141766#141766). Is it still the case?
I would really appreciate any information or facts provided.
Cheers.