requestPermission
方法。你可以通过
checkPermission
方法。它返回PPM\u DENY,然后修改代码中的onhrmControlBtnClick方法
/* Defines the error callback. */
function errorCallback(error)
{
console.log("The following error occurred: " + error.name);
}
/* Defines PermissionSuccessCallback. */
function permissionSuccess(result, privilege)
{
console.log("User's action for privilege " + privilege + " was to: " + result);
}
function onhrmControlBtnClick() {
console.log("onhrmControlBtnClick() called...");
tizen.ppm.requestPermission("http://tizen.org/privilege/healthinfo", permissionSuccess, errorCallback);
if (hrmControlBtn.innerHTML === TEXT_START){
console.log("info on button = start");
startSensor();
} else {
console.log("info on button = stop");
stopSensor();
}
}
我在我的设备上进行了测试,在我接受这个特权之后,应用程序开始正常工作。