Concatenate multiple makeWebRequest and makeImageRequest

Hi,

I've been struggling with the makeWebRequest and makeImageRequest. I'm working on a Watch Face that needs to call an API to get a json (makeWebRequest) and, based on that response, download an image (makeImageRequest). I was able to make both calls work as intended when called individually by background, 5 minutes appart, but having to wait around 10 minutes to get a full update is not a good experience. So I tried to call makeWebRequest (with an onReceive callback) and then call the makeImageRequest from that callback. The first request runs as expected, but the second request never calls its callback.

I have tried this example: https://github.com/aronsommer/WebRequestMultiple-Widget/tree/main

But it only works for Widgets, since Watch Faces need the background in order to make a request.

So my question is: is there a way to make both calls run without having to wait 5 minutes between them? Am I missing something here?

Appreciate any help!

  • Sounds like you are running into the 30 second max that a background can run,  Say the first request takes 10 seconds and the second takes 25 seconds.  You'll never see the callback from the second one.

    Add some debug logic to see how long the first request takes and then the second request. doing them one at a time.. You may want to look ate the server to speed up the slow request

    Also, you want to check your memory usage in the background.  Does doing the 2nd request based on the result of the first request use too much memory for a background process?