Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Retrieving images from the internet every day

I'm only a few days into fitbit clockface development, so please forgive me if this is too obvious. I want my clockface to download a new image from the internet every day and use it as a background. I can get the image and set it as a BG with the companion app with fetch(), but how do I trigger the download from the app itself? I want to trigger the function in the companion app from the watch don't I? I'm unclear on how that's achieved. I guess I'll need a test condition for the date, and if the image hasn't been downloaded already for that date (I'm going to host a server with 366 images), then trigger the download from the companion app and delete the previous image from the fs? I realise I may have  misunderstood the architecture so any advice is appreciated.

Best Answer
0 Votes
1 REPLY 1

I think the process you outlined would be the most efficient one. An issue is that the companion code doesn't run continually. For best results, give it a wake interval and run_background permission.

If that's not sufficiently reliable, you could check the need for a new image on the watch (app/index.js) and send a communication to the companion to wake it and trigger the download. However, I've found it best to try to do as much as possible in the companion.

Peter McLennan
Gondwana Software
Best Answer
0 Votes