I know we have the opportunity to save data before quitting app:
import { me } from "appbit";
me.onunload = () => {}
but it is a one way call with no return.
I had a long term test of my app yesterday and end up with an accidential quit of left button pressing during my sleep (I guess). It is a lap chronograph app with 100 laps data bank and 100 hours total counting time, it should not be quit without a double confirmation from user.
I am thinking of a system event which can prevent this.
Answered! Go to the Best Answer.
Best Answer
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.
You might be able to listen to events for the BACK button, and stop it exiting the first attempt, but use it wisely. You should always provide users with a way to exit.
Something like:
import document from "document"; document.onkeypress = function(evt) { console.log("Key pressed: " + evt.key);
if (evt.key === "back") {
evt.preventDefault();
}}
Best Answer
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.
You might be able to listen to events for the BACK button, and stop it exiting the first attempt, but use it wisely. You should always provide users with a way to exit.
Something like:
import document from "document"; document.onkeypress = function(evt) { console.log("Key pressed: " + evt.key);
if (evt.key === "back") {
evt.preventDefault();
}}
Best AnswerThank you for your prompt reply!
Yes, I do test that before without that key line of
evt.preventDefault();and leading to a mass,
🙂
Best Answer