Is it possible to detect wifi status change after app move to background?

I tried to get Wi-Fistatus change by using NWPathMonitor in foreground.
And I also put my code in SceneDelegate -> sceneDidEnterBackground , but it only can run once after move to background.

May I know is it possible to listening the Wi-Fi status change in background continuously?

Replies

May I know is it possible to listening the Wi-Fi status change in background continuously?

As with most things related to networking, NWPathMonitor works just fine in the background as long as your app isn’t suspended. Once your app gets suspend all in-app networking grinds to a halt. So, if you can prevent your app from being suspended then NWPathMonitor will work just fine. If not, you would need some mechanism to resume your app in the background when network conditions change. There’s no general-purpose way to do that, but there are a few special-purpose mechanisms. If you can post info about why you need to do this, I should be able to point you in the right direction (or confirm that it’s not feasible).

Share and Enjoy

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

  • Hello,

    Thank you ! Yes, I got the way to keep NWPathMonitor works in background. (By using update location)

Add a Comment