Languages

Menu
Sites
Language
Preferences are deleted when code is changed

Hi.

For example, launching app including below code,

    console.log(widget.preferences.getItem("test"));
    widget.preferences.setItem("test", "aaa");
    console.log(widget.preferences.getItem("test"));

then console log is "null, aaa". and launching again, console log is "aaa, aaa"

However, set preferences are deleted and  console log is "null, aaa" even if only slightly I change code (e.g removing one empty line).

Is this a default behavior? How can I config not to delete preferences when changing code

 

Responses

5 Replies
Marco Buettner

I should work on fly... But a similar behavior I have found on bada... When I worked with sessionStorage it doesn't change the entry.... But when I use localStorage I can not resproduce this issue.

Raghavendra Reddy Shiva

As the "widget.preferences" data is persistent and i was able to retain the values on every application re-start. Though i was getting exceptions when try to test/run on simulator as "Uncaught ReferenceError:widget is not defined", but was able to run on the Tizen device successfuly.

Are you doing a clean before building it again ? if so, then the data will be lost. And when you are installing the application on emulator or device (with RDS option disabled, Window > Preferences > Tizen SDK > Rapid Development Support) the application will be uninstalled and installed again and all the preferences/localstorage data is lost. 

Fujikawa

Thank you for detailed description.

However, I found that Rapid Development Support is enabled and Launching process is failed as below.

Step > Rapid development support[RDS]
    [RDS] Pushing file "C:/workspaces/tizen/SampleChatter/.build/.buildb0280ab0fd2b89fb/author-signature.xml" to "/opt/usr/apps/tmp/OCCXccsrUq/res/wgt/author-signature.xml" in target.
    [RDS] Pushing file "C:/workspaces/tizen/SampleChatter/.build/.buildb0280ab0fd2b89fb/js/main.js" to "/opt/usr/apps/tmp/OCCXccsrUq/res/wgt/js/main.js" in target.
    [RDS] Pushing file "C:/workspaces/tizen/SampleChatter/.build/.buildb0280ab0fd2b89fb/signature1.xml" to "/opt/usr/apps/tmp/OCCXccsrUq/res/wgt/signature1.xml" in target.
    [RDS] Pushing file "C:\workspaces\tizen\SampleChatter\.rds_delta" to "/opt/usr/apps/tmp/OCCXccsrUq/.rds_delta" in target.
$ /usr/bin/pkgcmd -q -r -t wgt -n OCCXccsrUq
start process (update)
.........................
error : 22

end process (fail)
processing result : SIGNATURE_INVALID [22] failed
spend time for pkgcmd is [238]ms
cmd_ret:22
    [RDS] Cannot partially upload or reinstall.
    Because the RDS failed , IDE'll try to install whole package again.
Step > Uninstalling the package

The same error is reported in the below post and is not solved(I use only ascii characters for file names)

https://developer.tizen.org/ja/forums/web-application-development/error-signature_invalid-after-updating-sdk-2.2.1

 
 
 
 
 
 
 
 
Alexander AVSukhov

Hello,

After reinstall app (uninstalled and installed againall the preferences/localstorage data is lost according to Raghavendra Reddy Shiva comment.

If you need save any predefined value you may add following to config.xml:

<preference name="test" value="aaa" readonly="false"/>

Raghavendra Reddy Shiva

Yeah this could be an alternative option, if your data is static and you know what key-pair values the application uses.