I have two apps which are successfully utilising multipeer connectivity to send messages.
Currently, when the "server" app moves to the background, I tear down the session and re-establish when returning to the foreground. Now, I need to make the server app responsive (to received messages) while in the background.
By being responsive, I mean can accept an incoming message, do the processing and return an acknowledgment to the peer - no UI required. When the App returns to the foreground, the messages received while in the background will be displayed.
I've disabled the MPC teartown on background notification and found that MPC automagically disconnects the "server" from the session - so my "client" peers see the server go offline.
Well, based on responses from the Apple Dev Forums, the answer is NO. Multipeer Communications is not supported while operating in the background. For those with access, link here: Apple Dev Forum
As per apple documentation "If the app moves into the background, the framework stops advertising and browsing and disconnects any open sessions. Upon returning to the foreground, the framework automatically resumes advertising and browsing, but the developer must reestablish any closed sessions" Refer: Apple doc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With