Understanding SDK and target device versions

Hi
Just want to sanity-check something (probably obvious)- I'm looking at using the Storage module to hold some data that I wish to persist for an application. The documentation indicates Storage module has existed since SDK version 2.4.0. When I attempt to configure the simulator for my device, a Forerunner 230, I see that the (compatible?) versions for the target are 1.3 & 1.4. I take this to mean that the Forerunner 230 doesn't support any SDK functionality beyond these versions, and therefore I have no means to persist user data on my device- Is this correct?

David

Top Replies

All Replies

  • The fr 23x, 630 and a few others (original va, f3, epix) only have CIQ 1.x.

    You can use App.getApp().getProperty() and App.getApp().setProperty() on older devices.  If you don't define a property/key in an xml, it stores that key in the object store instead of properties.  See the objectstore sample in the SDK.

  • Hi Jim,

    I always use "App.getApp().getProperty() and App.getApp().setProperty()" in my code,

    is there any advantage to use "Storage" for newer devices?

  • If you check the API doc, the way you're doing it goes away with CIQ4.

    Also with Storage you're not limited to 8k total, but 8k per key, up yo 100K total IIRC.

  • Jim the getProperty() and setProperty() are not marked to be deprecated with CIQ 4.  So they should still work.

    The original loadProperty() and saveProperty were removed in 3.0.  and the appbase.clearProperty() and appbase.deleteProperty() are going away in 4.0.

    The limits stated are accurate and good reasons to switch, where supported, to the storage module over the appbase object store.

  • You're right!  I could have sworn they were marked for CIQ4 at one point!

  • many thanks!

    so it is why i have some times an error on setProperty() 

    so if i get it well (my english is not so good) on the API doc,

    i keep setProperty() /getProperty()  for settings and use storage for my data on compatible device (app has :storage)

  • Personally when I reworked my widget last August, I tried to migrate all devices which (has :storage) to use the new format for both storage and properties modules and only use the setPropertiy()/getProperty() functions for devices <2.4.  

    Generally if it is not a setting that can be set via the phone or Garmin Express, then the key is best to be saved using the storage module.  Any key you try to access via the Properties module must have the key defined in the properties.xml resources file.  The storage/Property modules give you more flexibility over how and what can be stored, but you have to plan better how to best use the resources.

    Search in the programmers guide for "Which API Should I Use?" to get a couple points on how to migrate/use the new method.

  • If deleteProperty is now deprecated, what is the way of deleting a property? Can I just set it to null? 

  • The situation with the AppBase setProperty/getProperty/deleteProperty/clearProperties functions is not really ideal. We had planned to deprecate them with 4.0, but it was thought that this might cause some developers to freak out, so they were de-deprecated.

    The basic gist of it is that you should prefer the functionality in the Application.Storage and Application.Properties modules, and only fall back to the AppBase functions if you're developing for a device that doesn't have ConnectIQ 2.4 support. Even then it is my opinion that you should use jungles to conditionally compile helper functions that do the right thing for the device that the app is being built for.

    I think that it is safe to assume that if getProperty/setProperty are available that clearProperties and deleteProperty are also available. I realize it isn't documented that way, but that seems to be the reality of the situation.

  • Hi !

    In the dev guide we can find 

    // Set an Object Store app setting

    Properties.setValue("mySetting", mySetting);

    // Get an Object Store app setting value

    var mySetting = Properties.getValue("mySettin g");

    But the right syntax is 

    Application.Properties etc... Right ?