Send message to a server in background

Hello,

I am developing an standalone application on watchOS in order to send an alert to a server whenever a fall is detected. I'm using a workout session to collecte and process the user activities. Falls can be detected either if the application is in background or in foreground and a message is then send to a server. This is working fine when connected to the phone or over WiFi but if I'm using only 4G on the watch my messages are most of the time not sent if my app is not in the foreground.

To send these messages I use URLSession dataTask method with a session configure as default.

What should I had to be able to have the same comportment in 4G than with the other connection type ? Is this even possible ?

Best regards,

Coralie

You should not be using a workout session to detect falls. See https://developer.apple.com/documentation/coremotion/cmfalldetectionmanager instead.

Hello,

Thank you for the quick answer but this framework doesn't allow me to detect the type of fall I want to. That's why I'm doing a custom analysis. Also my app will not only detect fall.

Is it possible to send message to a server over 4G in real time when my app is in background as it is possible over WiFi and BLE ? Should I handle this in a background session to be able to use the 4G connectivity ?

Hello,

Do you have any ideas or any news about my case ?

Thank you for your help.

Best regards

Send message to a server in background
 
 
Q