Reachability and NEHotspothelper processed in the background

I use "Reachability" to monitor changes in WiFi status, "Reachability" monitors WiFi status changes very well when opening app or keeping the background running. But when the app is closed, Make WiFi connections on the system's WiFi list page , "Reachability" does not detect WiFi changes, and when WiFi changes, it does not post any notifications, this is what causes? Is there a way to accurately monitor WiFi status changes? I spent a lot of time searching and solving this problem, but I have not found a solution, who can get help. thanks! Note: "Reachability" version: https: //github.com/tonymillion/Reachability

Answered by DTS Engineer in 229650022

The issue here is that your app is being suspended when it goes into the background. The reachability API will not resume your app to deliver notifications, so you don’t get those notifications until your app is resumed for some other reason. Moreover, there’s no other API for resuming your app in the background on networking changes.

Share and Enjoy

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

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

The issue here is that your app is being suspended when it goes into the background. The reachability API will not resume your app to deliver notifications, so you don’t get those notifications until your app is resumed for some other reason. Moreover, there’s no other API for resuming your app in the background on networking changes.

Share and Enjoy

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

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

I found some clues by writing log. When the app is killed, enter the system WiFi settings list, there are as follows:


1. The app will "implicitly" start and call "didFinishLaunchingWithOptions".


2. Reachability will also be called and callback, but the timing of the callback is chaotic and irregular.


3. Then I would like to be able to monitor the change of WiFi status by the following code:


CFNotificationCenterAddObserver (CFNotificationCenterGetDarwinNotifyCenter (),

NULL,

SystemNetworkChangeCallback,

CFSTR ("com.apple.system.config.network_change"),

NULL,

CFNotificationSuspensionBehaviorHold);


Sometimes there is a callback, but the callback frequency is drastically reduced and not accurate enough


4. In the app was killed off the case, there is a perfect app to monitor the WiFi state changes. The address is: https: //appsto.re/cn/G2902.i



I am now in the development of a WiFi connection tool software, need to accurately monitor the user WiFi connection status changes.

Reachability and NEHotspothelper processed in the background
 
 
Q