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?
Parents
  • What exception is it throwing? If it's an ObjectStoreAccessException then it is because the device does not support 3.2.0 or later.

    The API docs don't mention 3.2 and earlier background limitations, but it is in the developers guide. (https://developer.garmin.com/connect-iq/core-topics/persisting-data/)

    Connect IQ 3.2 introduces the ability to access the Application.Storage module from background processes. The background process can 
    modify storage using Application.Storage.setValue(), Application.Storage.deleteValue() and Application.Storage.clearValues(). When the
    storage is written from the background process, Application.onStorageChanged() callback will be invoked for the foreground process if
    the background and foreground process are active at the same time and vice-versa. The application would then have to reload data from
    storage to reflect updated information.
Comment
  • What exception is it throwing? If it's an ObjectStoreAccessException then it is because the device does not support 3.2.0 or later.

    The API docs don't mention 3.2 and earlier background limitations, but it is in the developers guide. (https://developer.garmin.com/connect-iq/core-topics/persisting-data/)

    Connect IQ 3.2 introduces the ability to access the Application.Storage module from background processes. The background process can 
    modify storage using Application.Storage.setValue(), Application.Storage.deleteValue() and Application.Storage.clearValues(). When the
    storage is written from the background process, Application.onStorageChanged() callback will be invoked for the foreground process if
    the background and foreground process are active at the same time and vice-versa. The application would then have to reload data from
    storage to reflect updated information.
Children