© 2014 Samsung Electronics Co., Ltd. All rightsreserved.
Learning how to activate motion notifications for getting updated motion data is a basic motion management skill:
Define the action to be taken when the pedometer data changes. In the following example, the changed values are recorded in the console log:
function onchangedCB(pedometerInfo) { console.log("Step status: " + pedometerInfo.stepStatus); console.log("Cumulative calories: " + pedometerInfo.cumulativeCalorie); console.log("Cumulative distance: " + pedometerInfo.cumulativeDistance); console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount); }
To start listening to changes in the pedometer data, use the start() method to register the onchangedCB listener:
webapis.motion.start("PEDOMETER", onchangedCB);
To stop listening to the pedometer data changes, use the stop() method:
webapis.motion.stop("PEDOMETER");
Define the action to be taken when the user lifts a wrist to look at the watch device. In the following example, the changed values are recorded in the console log:
function onchangedCB() { console.log("Wrist-up"); }
To start listening to occurring wrist-up events, use the start() method to register the onchangedCB listener:
webapis.motion.start("WRIST_UP", onchangedCB);
To stop listening to occurring wrist-up events, use the stop() method:
webapis.motion.stop("WRIST_UP");