Replies: 4 comments
-
I would suggest implementing a import EasyStorage from "easy-storage";
const storage = new EasyStorage();
storage.setKey(...); // autosave the data on interval
...
Page({
onDestroy(){
storage.setKey(...); // ... and on app destroy
}
})
...
storage.getKey(...); // retrieve it on restart |
Beta Was this translation helpful? Give feedback.
-
Thanks for your suggestion. I've implemented this but I'm facing errors and it does not behave the expected way.
I'm giving you access to the repository, if you can take a quick look it would be great. |
Beta Was this translation helpful? Give feedback.
-
Still trying to figure out what is not working. Does EasyStorage works with ZeppOS v1? Do I need any extra config or something? I've looked to the examples and add some dependencies to app.json but still no luck. |
Beta Was this translation helpful? Give feedback.
-
Yes, I believe what you are facing @0ffTopic is the bug on zos v1 that is destroying storage contents on each save. ZeppOS v1 has reached its EOL, so unfortunately you can only use workarounds this time. Suggestions:
|
Beta Was this translation helpful? Give feedback.
-
Working on an app for ZeppOS v1.
I'm using this code on my app.js to keep my app open:
the user interacts with the app until the screen goes off, the user press the button and the watch screen turns on and I have all my previous data.
The problem here is, the user loses all data when going back to the app after a notification.
I'm trying to use a simple file to save all data and load it when the app is on the foreground again, but with no success (following ToDo app template code without the communication).
Is there other way to keep data or to prevent notifications when the app is running?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions