02-06-2019 05:50
02-06-2019 05:50
I'm working on a clock face and I'm getting weather info to display.
So far, I see two ways of "waking up" to refresh the weather:
1) in app\index.js, use setInterval. This calls a function that sends a message to the companion.
2) in companion\index.js, use wakeInterval. I listen for onwakeInterval events in the companion, which then updates the weather.
I've gotten both of the above to work, and they work as expected. I'm wondering what the pros/cons of each approach are. The things I'm thinking about are:
- what's better for battery? I have the weather updating every hour since it's not critical and I want to preserve battery as much as possible (both on the watch and the phone).
- so far, I haven't seen any errors in the logs for either approach. Is one more "bulletproof" than the other?
- ultimately, is there a "best practice" for either approach?
While both work, I'm assuming it's silly to use both in production code. Which one should I keep?