Replies: 3 comments
-
While this wouldn't be a bad thing to implement, we couldn't just start a timer in the background that pushes weather data every hour? |
Beta Was this translation helpful? Give feedback.
-
@liamcharger, while I wish we could do that, iOS is very strict about how code can run in the background. The only API I know of that can sort of achieve this is the schedule background tasks API. However, with the tests I have ran, it will only run once, maybe twice a day if you are lucky. The only consistent way I have found so far is running code when responding to the watch through a Bluetooth API call. Though instead of creating a new API call on the watch, we could for example change the battery API to send updated information every hour instead of whenever the battery percentage changes. That way we could use that to run background code in InfiniLink. |
Beta Was this translation helpful? Give feedback.
-
Ok, if that's the case, then updating the battery service periodically wouldn't be hard to implement. Also, thanks for pointing out the issues with using a timer or the Background Tasks API! |
Beta Was this translation helpful? Give feedback.
-
Hello everyone! Recently, I’ve been working on integrating the simple weather service API into InfiniLink. However, due to limitations in iOS, I’m only able to update the weather data when the watch makes a request. For instance, when the watch logs new step data. Unfortunately, this approach isn’t ideal because there are times when you’d want the weather information to refresh even when an existing API call is not being made. Therefore, I propose adding a new API call that runs every hour to prompt the app to refresh its data. This way, we can maintain a consistent time interval to run background code execution in InfiniLink that we can use to refresh any necessary information, like the weather data.
Beta Was this translation helpful? Give feedback.
All reactions