Complete
over 4 years ago

CIQQA-164

F5 can't save to Storage from Background (while F6 and others can)

Fénix 5 serie can't Toybox.Application.Storage.setValue from a Background process => throws an Exception. 

Fénix 6 and others like FR245 can. 

  1. It's not documented
  2. Bug or feature? 
  3. How to test programmatically if the device can saving to Storage from background without always needing to throw and catch such exception that is dirty, ugly and inefficient?
  • I’d like to save to Storage on the Background to transfer more data to the App than is possible by Backround.exit.

    Background.exit runs out of memory very unpredictably across devices anywhere between 2-6k of free memory.

    By saving to Storage right from the Background more data could be transfered without a crash.

  • This behaviour is an undocumented limitation.

    If possible move all Storage.setValue calls to logic that is only called if the app is not running in background context.

    In the past the simulator would not throw an exception, but recently this started being simulated (at least this was my experience). It throws an exception in the real devices. I had to refactor my code around this limitation.

  •  no, contrary the memory limits exception and contrary F6 series, this exception message explicitly tells the F5 is not allowed to setValue in the background process. 

  • Looking into the API it shows under Application.Storage.setValue:
    "Values can also be of type Array or Dictionary containing the above listed types, excluding BitmapResource and AnimationResource. There is a limit on the size of the Object Store that can vary between devices. If you reach this limit, the value will not be saved and an exception will be thrown. Also, values are limited to 32 KB in size."

    I'd assume the device is reaching its limit.