Application.Storage vs. Object Store (and User Settings)

Since I'm using CIQ > 2.4 I was transitioning to Object Store calling 

App.Storage.getValue("FTP")

 vs the older one which is

App.getApp().getProperty("FTP")

Which was working fine until I wanted to implement user settings on the widget I'm making.

With User Settings Properties.xml defined

		<property id="FTP"			type="number">200</property>

For the life of me, after reading and re-reading the programmer's doc, I couldn't see why I could get values back from using app.getApp()getProperty and NULL is returned from storage.getvalue.

is Storage only visible within the app and cannot be access by end users? (I can see it in the SIM under "Edit application storage data" though)

Top Replies

All Replies

  • With the old getProperty()/setProperty() calls, if the was a property in the xmk, it was a setting and would wind up in the apps .set file (and could be used as a setting).  With out something in the xml, it was in the objectStore and wound up in the .str file and could not be used for settings,

    With Application.Storage/Application.Properties, I'm nor sure what happens if Application.Storage is used for that/  With Storage, I just downt have anything in the XML,  the ,str file is aksi reokaced vy 3 fuke (index/data/something else and allows 8k per key instead of 8k total. 

    Settings is 8k total with both .getProperty/setProperty as well as Application.Properties, and both use the .set file.

    If you take the property of out the XML, your Application.Storage.getValue() will work after you have done a Application.Storage.setValue()

  • For the life of me, after reading and re-reading the programmer's doc, I couldn't see why I could get values back from using app.getApp()getProperty and NULL is returned from storage.getvalue.

    The Programmer's Guide has a bunch of documentation on this. I'm surprised you weren't able to find what you were looking for. I'll summarize.

    Prior to ConnectIQ 2.4, you only have AppBase::getProperty() and AppBase::setProperty(). These APIs provide access to Storage (data read/written by application code), Properties (defined in the resources.xml, read by the application, but not changeable outside the application) and Settings (defined in resources.xml, read by the application, and changeable via GCM or Garmin Express).

    ConnectIQ 2.4 split these up. Storage.setValue() and Storage.getValue() are for data that is only accessible within the application. Properties.getValue() and Properties.setValue() are for properties/settings.

    You cannot store a value using the AppBase methods and access it via Application.Storage (and vice-versa). Similarly, you cannot access a value written using Application.Storage via Application.Properties (and vice-versa).

    The part that you're not seeing is in the Accessing Properties and Settings section.

    Prior to Connect IQ 2.4, properties and settings were accessed the same way Object Store storage values are accessed. This functionality is still available, though use of the Application.Properties module is preferred on devices that support Connect IQ 2.4 or higher.

    In other words, you used to be able to access properties and settings with AppBase.getProperty(). With more recent devices you can use Application.Properties.getValue().