App running in background with External accessory background mode enabled doesn't receive sometimes the EAAccessoryDidConnect or the EAAccessoryDidDisconnect notification

Hi there! folks. Hope you are fine

We want our two applications to listen to connection and disconnection notifications in the External accessory when we connect a device to USB

These application are running in the background and we need to know when the device connects and disconnects from USB. In those cases, we have configured our apps to listen to local notifications as follows:

  EAAccessoryManager.shared().registerForLocalNotifications()

     NotificationCenter.default.addObserver(self, selector: #selector(didConnectAccessory(_:)), name: Notification.Name.EAAccessoryDidConnect, object: nil)

     NotificationCenter.default.addObserver(self, selector: #selector(didDisconnectAccessory(_:)), name: Notification.Name.EAAccessoryDidDisconnect, object: nil)

When the apps are running in foreground, everything works correctly. On the other hand, when the apps are running in the background mode and with the external accessory background mode enabled, the disconnection or connection event is not sent to the applications, causing them to not be able to initialize correctly.

We attach traces of the two applications running in the background in a connection event through the USB.

in The first application the Notification event is received correctly.

In The second application the Notification event is NOT received correctly

We would like to investigate with you what may be happening.

We have opened a case in the feedback assistant (FB13800710) so you can investigate further. We open the case here so that other people can collaborate with us in depth. Thank you so much

Looking forward to hearing from your side. All the best!

Same here

Thanks rioncool222, Do you have some extra information or logs to compare if this is the same issue? At our side, this happens ofthen with the applications running in the background mode after physical connection/disconnection from the USB Thanks for any feedback. All the best

App running in background with External accessory background mode enabled doesn't receive sometimes the EAAccessoryDidConnect or the EAAccessoryDidDisconnect notification
 
 
Q