Closed nathanmrtns closed 6 years ago
Just don't disconnect and start background task:
https://developer.apple.com/documentation/uikit/uiapplication/1623031-beginbackgroundtask
This will work for short running tasks, for long running your app needs to be in category of apps that are allowed to exectute long running background task, e.g voip
@jcavar What about the MQTTSessionManager with the connectInForeground flag?
That is I think opposite of what you want. MQTTSessionManager
can handle reconnection when coming from background, but you don't want to disconnect when you go to background?
@jcavar I see. Yeah, I want to keep the connection if the app goes to background.
The connection was closing when I blocked the device. I just made an observer that is notified everytime the application goes foreground and the session is not connected. This resolved my problem, but any other suggestion is welcome :)
Hi, every time the app goes to background the connection closes. I've seen some codes here that is possible to maintain the connection but I don't know how to adapt. Any help?