Network Socket Background Task

Hello everyone,

I have developed an app that is a local networking monitor app for a specific building automation protocol.

I have searched the forum and I think I have found some older posts regarding this topic but I could not figure out if my issue falls under the same category.

So my app allows the user to connect to local protocol devices, and start a monitor session where they can see incoming/outgoing packets. The connections are UDP or TCP and require opening a socket.

Currently, backgrounding the app will make the OS terminate the socket connection, therefore ending the monitor, even if the app is backgrounded by user, to let's say, perform some other task in their phone.

I have several requests from users to improve the app by allowing the monitor to continue while the app is backgrounded. However, by reading the relevant documents, I have found this to be almost impossible in iOS app. I have considered:

  • Remote Push Notifications (APNs): The app operates on LAN so this is not an option, since I do not have an infrastructure to somehow send notifications to keep app process alive.

  • Background Tasks (BGTaskScheduler): Not my case, since I do not want periodic execution. The app requires continuous socket listening.

  • VoIP, VPN, or Audio Background Modes: My app does not fall under any of these categories, even though this would solve my situation.

By searching around a bit more, I might be able to use either BGProcessingTask, which would allow my app at least to run for some minutes and show the user that they have to foreground it in order to not stop the monitor process, or maybe even App Intents framework.

Has anyone faced similar requirement for their app? Any tip or point to a direction I should investigate more?

Thanks,

Nikos

Network Socket Background Task
 
 
Q