Created
June 20, 2016 23:23
-
-
Save mohamedmenasy/c552fd16638ed9e07e7179e6aa7f4c05 to your computer and use it in GitHub Desktop.
Tizen Wearable Pedometer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function() { | |
tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB); | |
// add eventListener for tizenhwkey | |
document.addEventListener('tizenhwkey', function(e) { | |
if (e.keyName === "back") { | |
try { | |
tizen.application.getCurrentApplication().exit(); | |
} catch (ignore) { | |
} | |
} | |
}); | |
}; | |
function onsuccessCB(pedometerInfo) { | |
console.log("Step status : " + pedometerInfo.stepStatus); | |
console.log("Cumulative total step count : " | |
+ pedometerInfo.cumulativeTotalStepCount); | |
tizen.humanactivitymonitor.unsetAccumulativePedometerListener(); | |
} | |
function onerrorCB(error) { | |
console.log("Error occurs. name:" + error.name + ", message: " | |
+ error.message); | |
} | |
function onchangedCB(pedometerInfo) { | |
console.log("Step status : " + pedometerInfo.stepStatus); | |
console.log("Speed : " + pedometerInfo.speed); | |
console.log("Walking frequency : " + pedometerInfo.walkingFrequency); | |
console.log("Cumulative total step count : " | |
+ pedometerInfo.cumulativeTotalStepCount); | |
console.log("Accumulative total step count : " | |
+ pedometerInfo.accumulativeTotalStepCount); | |
tizen.humanactivitymonitor.unsetAccumulativePedometerListener(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment