03-13-2019 08:13
03-13-2019 08:13
Trying to figure out how to delete and re-create the file where I save the settings for my clockface whenever the app is re-installed. Is there an event that fires on installation? Or is there some other way to perform a certain function only when the app is first installed?
Thanks.
Best Answer03-14-2019 09:34
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
03-14-2019 09:34
There's not an API for this, but you can write a file to the file system containing a version number, or check for the existence of a particular version of the settings file. e.g.
try {
settings = fs.readFileSync("settings-v2.cbor", "cbor");
} catch(ex) {}
if (!settings) {
try {
settings = fs.readFileSync("settings.cbor", "cbor");
} catch (ex) {
settings = defaults;
}
}
Best Answer