Hi, I've made a widget that sends heart rate data to an android application but when the screen on my Venu Sq goes off the widget stop working.. so I'm searching a method to send data also after the screen off or if i close the widget.
Hi, I've made a widget that sends heart rate data to an android application but when the screen on my Venu Sq goes off the widget stop working.. so I'm searching a method to send data also after the screen off or if i close the widget.
You can do it from a background service, but that can only run every 5 minutes and for 30 seconds at a time..
So what would be the best practise to do something like this ? My goal is to get most data possible about a user each time he open the widget
The widget would need to be running all the time for "real time" data, but on watches, widgets time out in at most a couple minutes. You could do it as a device app which will run until the battery dies but you couldn't run anything else.
In other words, you can't really do what you want except for a short time.
This is just for the data collection in your app. The BLE side, that can be done in the background (again, every 5 minutes at most), but it also depend on what you are trying to interface with. With a phone that's already using BT to talk to the watch, probably not. Here's WF I did a while back that talks to a thingy52 using a background service. It's not real useful as the thingy powers down after a few minutes.
Can device app being stoped if user wanted it to stop?