tizentizen-wearable-sdksamsung-galaxy-geartizen-emulatorsamsung-gear

Heart rate sensor in Gear 3 samsung


I use sample https://resources.developer.samsung.com/050_Samsung_Webinars/Heart_Rate_Monitor_Sample_App_Guide

in Samsung site and download from example. my issues are, this sample work in simulator but in real device Gear 3 Samsung sensor not work and return zero.

id add this code, but not work


Solution

  • If you have Tizen 4.0 it might be connected with privacy policy. Please try use requestPermission method. You might check permission by checkPermission method. It it return PPM_DENY then modify onhrmControlBtnClick method in your code to

    /* 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();
        }
    }
    

    I tested on my device and after I accept this privilege, application start working properly.