Acknowledged

Background.exit() stops working on Watch Face in some cases

I'm developing a watch face and testing it on Garmin Fenix 7 with the latest firmware (in the emulator everything works well). I have a background service there with makeWebRequest function. To debug I've simplified it as much as possible and prevented exceeding 8kb data limit this way:

// Application.AppBase class
function onBackgroundData(data) {
    System.println("onBackgroundData call");
    System.println("data = " + data);
}

// System.ServiceDelegate class
function HTTTPResponseCallback(responseCode as Number, data as String or Dictionary or Null) as Void {
    // ignore data
    System.println("HTTTPResponseCallback call");
    Toybox.Background.exit("Success");
}

Most of the time it logs the following:

HTTTPResponseCallback call
onBackgroundData call
data = Success

But sometimes after the device is reloaded or after waking up and exiting sleep insights widget I'm getting this:

HTTTPResponseCallback call
HTTTPResponseCallback call
HTTTPResponseCallback call
HTTTPResponseCallback call
HTTTPResponseCallback call
...

So, it seems that Toybox.Background.exit() stopes passing any data. 

I've found some topics regarding this on developers forum that developers time to time face this issue, but it's hard to catch exact moment it happens. That is why you could see that most of watch face developers use Storage.setValue() and onStorageChanged() as a workaround. The most often I catch this bug when switch off and switch on my Fenix 7 device. It happens every 3rd time. 

Parents
  • I just upgraded to a Samsung S23 Ultra because I love its features, but I'm scared of dropping it. Given its sleek design, how can I find a case that offers top-notch protection without hiding its beauty? Where's the best place to shop for such a case?

Comment
  • I just upgraded to a Samsung S23 Ultra because I love its features, but I'm scared of dropping it. Given its sleek design, how can I find a case that offers top-notch protection without hiding its beauty? Where's the best place to shop for such a case?

Children
No Data