BackGround (WF) and updated OS Storage

HI,

i'm playing around with CIQ, trying to push my watch to its limits...

I have a problem with var between app and BG.

So i write OS storage data to get it read in BG.

It works perfectly in simu, while on my watch (saw it thanks to -many- println ) the data is only get once, never the last data updated in the view.

(I have 2 differents URL in my BG for a webrequest, depending on time and others tricks)

I 'm making a getProperty in onTemporalEvent, not working. I put my getProperty in BG initialize(), idem.

So i put this in onStop() :

    if ( Toybox.System has :ServiceDelegate ) {
            Background.deleteTemporalEvent();
            Background.registerForTemporalEvent(new Time.Duration(intervalWebRequest.toNumber() * 60));
        }

and it seems to work.

I do not like this way of doing it,

so where am i missing something, does the BG as soon as starting fully disconnected from the OS (has its own copy of it??)

May it be some bug, is there no way to get updated data via OS, in the BG?

thanks for any help !

  • Hi ,

    is there any way to know the storage memory usage ?

    thanks

  • From the Programmer's guide, here's the limits:

    Connect IQ 2.4 introduces the Application.Storage module, which manages persistent key-value pair data storage. Information is automatically saved on disk to a .IDX and .DAT file pair when Application.Storage.setValue() is called. Keys and values are limited to 8 KB each, and a total of 128 KB of storage is available.

    ------

    As far as what's currently being use you should be able to estimate that based on your app.

  • thanks Jim.

    But i was looking at something like getSystemStats() used/free etc. directly for Storage.

    getSystemStats.usedStorageMemory or freeStorageMemory. would have been a great idea from Garmin, ... !

  • But I I receive an bitmap from Internet, I can not use

    var result = {

    "img" => image,//type is BitmapReference

    "type" => 1

    }

    Background,exit(result). 

    I checked the apidoc

    exit(backgroundData as Application.PropertyValueType) as Void

    Terminates the current background process.

    All background processes should call this method when they have completed the desired tasks. Data passed to this method will either be passed immediately to the active application if it is running, or will be saved and passed to the application the next time it runs. Data must be one of the following types:

    Arrays and Dictionaries may contain null values or any of the above listed types. If no data should be passed to the main process, null may be specified.

    This method will exit if called by a background process, but will do nothing if called by the main application process.

    Bitmap is not supported.

    BTW.

    I find Storage.setValue(xxx,xxx)  in background(simulator) is OK now. Perhaps on some devices merely.