makeRequest does not call method(:onReceive) in background / WF

Hi !

i've a problem i can't deal with (as a newbie!)

In a watchFace, i put a background Service to call a Financial web service API (would be the same for weather API).

The BF is ok, makeRequest call the webservice, i have my info in the simu / file -> View HTTP Traffic.

But after the request, onreceive function isn't called.

Andy Idea ?

(i put Sys.println almost everywhere…  !)

thanks !

Marco

PS:

time simulation speeding Don't  have any impact on background time services?

I set time simu to x100 faster, but obliged to wait for 5mn !

(

testing target MK1

Photon 4.8.0

SDK 3.1.6

)

  • You can't pass the image from the background back to your main app.  bg.exit() only supports the data types you can have in storage

  • Thanks. i may have change something for my weather request (i probably did !).


    no image ing bg.exit(), ok.
    but I was sure i would have been able to put the receive image in a global ?

    so why can i use makeImageRequest in BG but not use RECEIVED image (or at least, it seems i received it) ?

    seems strange for me (since i'm not familiar with all Garmin limitations and specs...)

    thanks for your time. I'm at the end of my V1 "CubeWatch" WF , will use weather fontIcon (even if i would have succeed in dealing with web icon).

  • The backround has it own globals.  They are not global between the main app and the background - they are separate.

  • ok.Copy that. Thanks.

    So i can read Global app data from BG °, but since BG is fully asynchronous, can just return data by the store on bg.exit().

    <edit>

    ° : read, from BG, only by STORES via getProperty()...

    </edit>

    Hum...What can i do with an image, in WF BG?

  • Hum...What can i do with an image, in WF BG?

    Nothing.

    It's an oversight that  background.exit does not support images so makeimagerequest is not useful in a watch face.

  • thanks Peter...maybe in some next SDK...

    thanks for all your help Jim !

    here is my V1 :

    will test it, some job to do with pressure (not the same than in the watch !), with heartratemax (can't have it in the watch while in the simu it's ok). I'll optimize code, and next will be users settings !

    (i have a crash in simu, without any notice nor msg anywhere, just the  IQ icon with the yello "! " after some times running. I have to investigate that !)

    Thank you very much !

  • Hi !

    no questions ...

    just a link for my testing watchFace:

    https://apps.garmin.com/en-US/apps/0ac97c3d-bbd5-4d12-a8f3-606e53691603

    (already working on V2 because lot of job to improve it !)

    Does anyone knows if we can developp on Garmin Glasses ??

    Future - according to me - will be on Glasses rather than any screens ;-)

    thanks.

  • Toot a quick look at it in the store.  You may want to check the permissions you have set, as there are things like BLE and ANT you don't use

  • thanks.

    i'll uncheck BLE and ANT permissions...

    now woking on a loop for BG makeWebRequest ...

    I'm having a lot of trouble to get the Lat/long still in memory (even with OS, after a long time they are cleared?)

    and when going to me menu "connexion/OnOff/synchro etc) my view is reset (specifically weather and stock market data)...  have to work on it !

  • currentLocation goes "stale" after a period of time and will be null.  That's why you want to save off good ones in storage - so when it does go stale, you can use the last value in storage.

    Sounds like you also need to put your data in storage, so that when you leave the watch face and return, you'll want to have data to display without waiting for the next temporal event.