janderkan Well-Known Member Licensed User Longtime User Nov 9, 2017 #1 In Android I have MQTT functions in a service that is started with Startforeground. In IOS there is no Startforeground. How can I make sure that MQTT is always running.
In Android I have MQTT functions in a service that is started with Startforeground. In IOS there is no Startforeground. How can I make sure that MQTT is always running.
Erel B4X founder Staff member Licensed User Longtime User Nov 9, 2017 #2 As I answered to your other post, you should use this code: [B4X] MQTT - Connect & Reconnect Once your app moves to the background, it will disconnect. It will reconnect when it returns to the foreground. Upvote 0
As I answered to your other post, you should use this code: [B4X] MQTT - Connect & Reconnect Once your app moves to the background, it will disconnect. It will reconnect when it returns to the foreground.
janderkan Well-Known Member Licensed User Longtime User Nov 9, 2017 #3 Yes I do use this code. But in Android, without Startforeground, the service is killed. And in Ios I expect the same, but there is no Startforeground. I need the service to run always. Upvote 0
Yes I do use this code. But in Android, without Startforeground, the service is killed. And in Ios I expect the same, but there is no Startforeground. I need the service to run always.
Erel B4X founder Staff member Licensed User Longtime User Nov 9, 2017 #4 You cannot run apps in the background in iOS*. * - there are some specific exceptions which are not relevant to this use case: https://developer.apple.com/library.../BackgroundExecution/BackgroundExecution.html Upvote 0
You cannot run apps in the background in iOS*. * - there are some specific exceptions which are not relevant to this use case: https://developer.apple.com/library.../BackgroundExecution/BackgroundExecution.html
janderkan Well-Known Member Licensed User Longtime User Nov 9, 2017 #5 My app will include a GeoFence service, this I can mark as Background execution, type location. Will it be too creative to put my MQTT in the same service Upvote 0
My app will include a GeoFence service, this I can mark as Background execution, type location. Will it be too creative to put my MQTT in the same service
Erel B4X founder Staff member Licensed User Longtime User Nov 10, 2017 #6 Geofence will not help. The OS will start the app when the user crosses the region and will then stop it. It cannot be used to run lengthy tasks in the background. Using background location might be more relevant. Upvote 0
Geofence will not help. The OS will start the app when the user crosses the region and will then stop it. It cannot be used to run lengthy tasks in the background. Using background location might be more relevant.