Ticket Created
over 3 years ago

WERETECH-11175

set/getProperty deprecate on sdk 4?

In current doc something has changed!!

Previous information: some function (e.g. deleteProperty) was planned to remove but not set/get.

My app run well and there are values in sim Application.AppBase.Data.

So, is documentation correct?

I have some strange app behaviour on sim:

- settings don't change

- memory peaks

- console  message "Unable to serialize app data"

- resetting settings to default

can be connected with any changes in sdk 4?

Parents
  • We wanted to remove getProperty/setProperty with 4.0, but could not officially do so because the deprecation warning for those functions had been removed.

    The are officially deprecated now, and we plan to remove them with ConnectIQ System 5 (the docs will get updated soon, probably with the 4.0.2 release). You should update your apps to use the Application.Storage or Application.Properties modules on devices that have support.

Comment
  • We wanted to remove getProperty/setProperty with 4.0, but could not officially do so because the deprecation warning for those functions had been removed.

    The are officially deprecated now, and we plan to remove them with ConnectIQ System 5 (the docs will get updated soon, probably with the 4.0.2 release). You should update your apps to use the Application.Storage or Application.Properties modules on devices that have support.

Children
  • o time I have enough memory (especially you suggest class, members and consumption memory too)  I prefer not to mix in jungle, my solution:

        function setPrp(k, v)
        {
            if(APP has :Storage)
            {
                APP.Storage.setValue(k, v);
            }else
            {
                APP.getApp().setProperty(k, v);
            }
        }
        
        function getPrp(k)
        {
            if(APP has :Storage)
            {
                return APP.Storage.getValue(k);
            }else
            {
                return APP.getApp().getProperty(k);
            }
        }

  • It'll be removed form CIQ on devices so it'll be possible to compile code with set/getProporty with sdk >4 for devices with ciq <4, correct?

    The functions would not exist for devices with ConnectIQ 5.x (System 6) support, but would exist for earlier devices. i.e., we would leave existing devices as-is (simulated and physical devices), and future devices would just not have those functions at all.

    The easiest way around this is to have a wrapper that is conditionally compiled. You can use build exclusions to select which file/function is compiled in for each device.

    // source-classicStorage/MyStorage.mc
    module MyStorage
    {
        var _theApp;
    
        function _getApp() {
            if (_theApp == null) {
                _theApp = Application.getApp();
            }
            
            return _theApp;
        }
    
        function getValue(key) {
            return _getApp().getProperty(key);
        }
        
        function setValue(key, val) {
            return _getApp().setProperty(key, val);
        }
        
        function deleteValue(key) {
            return _getApp().deleteProperty(key);
        }
        
        function clearValues() {
            return _theApp().clearProperties();
        }
    }
    
    // source-modernStorage/MyStorage.mc
    module MyStorage
    {
        function getValue(key) {
            return Storage.getValue(key);
        }
    
        function setValue(key, val) {
            return Storage.setValue(key, val);
        }
        
        function deleteValue(key) {
            return Storage.deleteValue(key);
        }
        
        function clearValues() {
            return Storage.clearValues();
        }
    }
    
    
    

    // default.jungle
    project.manifest = manifest.xml
    
    # devices that do not have Application.Storage module go here
    vivoactive_hr.sourcePath = $(vivoactive_hr.sourcePath);source-classicStorage
    
    # devices that do have Application.Storage module go here
    fenix6.sourcePath = $(fenix6.sourcePath);source-modernStorage

  • 1. From previous post, developer can (and even should) use the latest SDK.

    2. It'll be removed form CIQ on devices so it'll be possible to compile code with set/getProporty with sdk >4 for devices with ciq <4, correct?

    3. Of course (but I'm not sure) it's possible to prepare iq file combining prg building with in different sdk but it produce more work (if not there should be several iq's for different platform).