Retrieve Network Signal Strength

According to the instruction on your site, we can finally retrieve Network Signal Strength information as expected after being added into Network Extension Entitlement list. That sounds great! 🙂

However, there is still one concern that we cannot get the update signal strength when the Network signal changes constantly.

Could you please specify which function/method we should use to get the update data?

For details, here is our current code to get the update:

NSMutableDictionary *options= [[NSMutableDictionary alloc] init];

[options setObject:@"Hotspot" forKey:kNEHotspotHelperOptionDisplayName];


BOOL returnType = [NEHotspotHelper registerWithOptions:options queue:dispatch_get_main_queue() handler: ^(NEHotspotHelperCommand * cmd) {


// our implementation code here cannot be processed even though the returnType == TRUE


}];


.........

//GET NETWORK

NSArray * networkInterfaces = [NEHotspotHelper supportedNetworkInterfaces];

NEHotspotNetwork *network = [networkInterfaces lastObject];

double signalStrength = network.signalStrength; // the value of network.signalStrength is not updated constantly here


In addition, I'm concerned that we can retrieve the history of 24-hour Online Status or not?

Looking forward to receiving your advice,😉

Thanks,

Add a Comment

Accepted Reply

Regarding the 1st issue, our issue is that we cannot get live updates of the signal strength although I am still managing the currently connected Wi-Fi.

Could you please point out what wrong in my code that makes me unable to retrieve the live updates?

You should confirm that:

  • +supportedNetworkInterfaces
    returns the network in question
  • when you call

    -isChosenHelper
    on the network returned by
    +supportedNetworkInterfaces
    , it returns true

If both of the above are correct and you still don’t get signal strength updates, I’ve no idea what’s going on. You can either file a bug about this or, if you still think it’s something wrong with your code, open a DTS tech support incident and I can take a look in a more formal context.

And what I meant the "24-hour Online Status" is some kind of like the history of 24-hour Internet usage where there is up&down in the network connectivity as …

iOS has no API that returns this sort of information on your behalf.

To capture this information yourself you’d have to run periodically in the background, which isn’t something that iOS supports in general.

Share and Enjoy

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

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

Replies

NEHotspotHelper was not designed as a general-purpose Wi-Fi scanning API. As such, it has a bunch of limitations. One of those is that Wi-Fi signal strength is only updated for networks that your hotspot helper is managing. See this post for details.

In addition, I'm concerned that we can retrieve the history of 24-hour Online Status or not?

What do you mean by “Online Status”?

Share and Enjoy

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

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

Dear Eskimo,


Sorry for reply late!

Regarding the 1st issue, our issue is that we cannot get live updates of the signal strength although I am still managing the currently connected Wi-Fi.

Could you please point out what wrong in my code that makes me unable to retrieve the live updates? 😊


And what I meant the "24-hour Online Status" is some kind of like the history of 24-hour Internet usage where there is up&down in the network connectivity as

https://gyazo.com/62c9a40d749678639b2a3dd701dcfac3


Thanks and Best Regards,

Bao

Regarding the 1st issue, our issue is that we cannot get live updates of the signal strength although I am still managing the currently connected Wi-Fi.

Could you please point out what wrong in my code that makes me unable to retrieve the live updates?

You should confirm that:

  • +supportedNetworkInterfaces
    returns the network in question
  • when you call

    -isChosenHelper
    on the network returned by
    +supportedNetworkInterfaces
    , it returns true

If both of the above are correct and you still don’t get signal strength updates, I’ve no idea what’s going on. You can either file a bug about this or, if you still think it’s something wrong with your code, open a DTS tech support incident and I can take a look in a more formal context.

And what I meant the "24-hour Online Status" is some kind of like the history of 24-hour Internet usage where there is up&down in the network connectivity as …

iOS has no API that returns this sort of information on your behalf.

To capture this information yourself you’d have to run periodically in the background, which isn’t something that iOS supports in general.

Share and Enjoy

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

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

I've made a recheck and seen that "supportedNetworkInterfaces" did return the network like:

Network List : (

"<CNNetwork SSID Mag_Rabbit BSSID 64:66:b3:6d:5e:36 [protected] [signal 0.70436] [Auto-Join] 0x17e7fdf0>"

)

However, the field "chosenHelper" returns FALSE, rather than True as your suggestion.

Do you have any insights into this issue?


Regarding the "24-hour Online Status", thanks for your recommendation, I think I should use the background thread to track this info.

Bao

Do you have any insights into this issue?

The hotspot infrastructure does not believe your helper is managing this hotspot network. As discussed in the thread I referenced in my first response, it seems that your hotspot helper only get signal strength updates if it’s the chosen helper for that network.

To become the chosen helper it has to run through the hotspot state machine per Figure 1-1 in the Hotspot Network Subsystem Programming Guide.

Regarding the "24-hour Online Status", thanks for your recommendation, I think I should use the background thread to track this info.

That won’t work because your app will be suspended when it moves to the background.

Share and Enjoy

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

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

Hi there Quinn,


Sorry for reply late because I still try to implement as per your suggestions; however, there is still one issue that stops me from retrieving the "live update" network strength.

For details, I did get the "live update" strength when there is no connected wifi network before my app installation, which means that after my app is installed and I try to connect to one specific wifi network, then the app can easily get the "live update". But in case there is already connected wifi, then the app is installed and the app cannot retrieve the "live update" in this ordinary circumstance. Please help give me some insights to tackle this one.


Regarding the "24-hour Online Status", yeah, I just do some research on google and figure out that we can utilize the feature "Silent Notifications" to wake up iOS apps to run some task in the background like Auto-Sync functionality for instance.

Best Regards,

Bao

But in case there is already connected wifi, then the app is installed and the app cannot retrieve the "live update" in this ordinary circumstance.

Right, that’s because in that case your app isn’t managing this Wi-Fi network (because the OS was able to join the network when your app was not installed).

Regarding the "24-hour Online Status", yeah, I just do some research on google and figure out that we can utilize the feature "Silent Notifications" to wake up iOS apps to run some task in the background like Auto-Sync functionality for instance.

Be aware that silent pushes are governed by a resource budget. Depending on available resources you may find that such push notifications aren’t delivered to the device, or are delivered to the device but don’t cause your app to resume (or relaunch).

Share and Enjoy

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

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

Hi there Quinn,


"Right, that’s because in that case your app isn’t managing this Wi-Fi network (because the OS was able to join the network when your app was not installed)."

==> So it means the only solution is to force users to turn off and then turn on wifi to allow my app to get the "live update", right?


Regarding the "24-hour Online Status", what you meant "resource budget" is about the remaining memory resource or the battery percentage, correct?

If so, is there any other reasons causing my app not to resume/relaunch?

Best Regards,

Bao

So it means the only solution is to force users to turn off and then turn on wifi to allow my app to get the "live update", right?

I’m confused. If the device is capable of joining the Wi-Fi by itself, without the help of your hotspot helper, then why is your hotspot helper involved at all?

It sounds like you’re trying to use the hotspot helper API to build an app that does Wi-Fi signal strength monitoring, which runs counter to its intended use case. NEHotspotHelper allows you to create a hotspot helper, that is, an app that helps the user navigate a hotspot, a Wi-Fi network that requires specific interactions (logging in, agreeing to terms and conditions, and so on) before allowing the user to access the wider Internet.

Regarding the "24-hour Online Status", what you meant "resource budget" is about the remaining memory resource or the battery percentage, correct?

iOS has a complex resource budgeting system. There are lots of resources managed by that system, including memory, power, and network usage. That system has many inputs, including the user’s typical daily activities.

Share and Enjoy

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

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

"I’m confused. If the device is capable of joining the Wi-Fi by itself, without the help of your hotspot helper, then why is your hotspot helper involved at all?

It sounds like you’re trying to use the hotspot helper API to build an app that does Wi-Fi signal strength monitoring, which runs counter to its intended use case."

==> Yes, actually I tried to use the hotspot helper for the purpose of updating Wifi Signal Strength in my app as https://gyazo.com/20f4e2d0d1b39256bddd2b297e309001

rather than helps the user navigate a hotspot.

We did research on google and it appears that the only solution to get "live update" is using Hotspot Helper.

Best Regards,

Bao

Yes, actually I tried to use the hotspot helper for the purpose of updating Wifi Signal Strength in my app as … rather than helps the user navigate a hotspot.

OK. This is not an expected use case for NEHotspotHelper, which explains why you’re having such a hard time at a technical level.

WARNING While I can only advise you on technical stuff, I would like to point out that there are legal implications here as well. Network Extension framework is specifically discussed in section 3.3.26 of the Apple Developer Program License Agreement.

Share and Enjoy

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

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

Yeap, thanks for your advice @Quinn, I will take it into consideration.

Once again, thank you so much for your great support! 🙂 🙂 😉

Bao