Get value of Wi-Fi Settings

Hi !

I'm working on a mobile application in Xamarin Forms.

I need to detect whether Wi-Fi is enabled (I don't need to detect if the phone is connected to a network, and I don't need to be connected to a network with internet either). However, I need to know the true/false value of the Wi-Fi settings on my iPhone.

I have searched through the iOS APIs, but I haven't found anything corresponding to it.

Which API could be used to "get" the value of the settings?

Which API could be used to "get" the value of the settings?

That is no API to get that specific setting. Why do you need it?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

In the context of a professional application, my client wants an app that alerts a user when the Wi-Fi settings are disabled and offers to redirect them to the phone's settings.

Therefore, my mobile application needs to detect the state of the Wi-Fi settings.

If the settings are not enabled, a popup notifies the user that they need to enable it. Additionally, I add a button that allows them to navigate to the settings.

That's the use case.

Is there any way that i can get this settings status ?

Additionally, I add a button that allows them to navigate to the settings.

How are you doing that?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I didn't at the moment.

I need to know if we have a way to detect the status of Wifi Settings. I thougth that was a common case.

i need to detect 2 states :

Wifi OFF Wifi ON (connected or not to a network)

Any idea about a technical workaround ?

Any idea about a technical workaround ?

If @eskimo says “[There] is no API to get that” – believe it.

my client wants an app that [does some unusual stuff]

Unfortunately you’re in the position of needing the manage the client’s expectations. We get that a lot around here.

Generally speaking, preflighting network access like this is discouraged on iOS. If possible, just proceed with your app’s desired network access and handle any errors gracefully. Remember that even if you could detect the Wi-Fi switch, and even if you used something like NWPathMonitor to check for network access, then any given network access could still fail for any reason. So first make sure the app is rock solid in those scenarios.

Also, why specifically check for Wi-Fi? Is the app intended to be unusable over cellular data? That may be another of the client’s desires that could use a review.

You wrote:

Additionally, I add a button that allows them to navigate to the settings.

I wrote:

How are you doing that?

You wrote:

I didn't at the moment.

Is that your response to my question? Because, if so, it suggests you’ll run into another snag down the line: There’s no supported way to open Settings > Wi-Fi. See this post.


Scott wrote:

why specifically check for Wi-Fi? Is the app intended to be unusable over cellular data?

Yeah, this is key. Many folks ‘live’ on WWAN. Their WWAN service is much better than their Wi-Fi service, if they have Wi-Fi at all. These folks get grumpy if you nag them to enable Wi-Fi. There are good solutions to that problem — see the link to WWDC 2019 Session 712 in Networking Resources — but it’s hard to say whether this is relevant to you because we don’t have a lot of details about your ultimate goal.

If you’d care to post more context, I’d be happy to offer specific advice.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Get value of Wi-Fi Settings
 
 
Q