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.