Languages

Menu
Sites
Language
(Web API)센서 데이터를 가져올 때 화면이 꺼지면 값을 가져오지 못합니다.

안녕하세요 Gear S3 웹 어플리케이션 개발중입니다.

아래와 같이 1초마다 센서 데이터를 가져와서 데이터를 수집중에 있습니다.

var pressure;

function getPressureData() {
 var pressureSensor = tizen.sensorservice.getDefaultSensor("PRESSURE");

 function onGetSuccessCB(sensorData) {
  pressure = sensorData.pressure;
 }

 function onerrorCB(error) {

  console.error(error.message); // Operation failed

  pressure = null;
 }

 function onsuccessCB() {

  pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
 }
 pressureSensor.start(onsuccessCB);
}

 

setInterval(function() {
   
   getPressureData();

  }, 1000);

 

 

화면이 켜져있을 때는 센서데이터를 잘 수집하지만, 화면이 꺼지면  Operation failed  에러메세지를 출력합니다.

어떻게 해결할 수 있을 까요?

 

아래 방법을 사용해보았지만 해결되지 않았습니다.

tizen.power.request("CPU","CPU_AWAKE");

 

자바 스크립트 파일 첨부하였으니 확인부탁드립니다

모바일과 통신할 수 있는 HelloAccessory 샘플을 기반으로 만들었습니다.

 

그리고 아래 함수로 heartrate 를 가져오고 있는데

심박측정이 잘 되다가 어느 순간 리턴값이 -3 으로 출력되고 wear 자체 심박측정앱도 동작을 하지 않는데 원인이 무엇인지 알수 있을까요?

tizen.humanactivitymonitor.getHumanActivityData("HRM", onGetSuccessCB, onerrorCB);

 

 

 

Edited by: Sangil Im on 15 Jan, 2018

Responses

2 Replies
Iqbal Hossain

You may try by adding this 

<tizen:setting background-support="enable" />

Also may follow this https://developer.tizen.org/ko/forums/web-application-development/web-app-running-background?langswitch=ko

GEUNSOO KIM

1. the cause is that tizen system, especially weearable devices, puts your app into sleep mode no matter what you do in program unless there is user activity.

I think it looks too much on power saving though..

2. if "tizen.power.request("CPU","CPU_AWAKE");" had not worked, you'd better check privilege and where you put the line again. try put the line on your app start. anyway this will drain battery very fast.

3. if nothing is working, you may try alarm to wake your app periodically. In this case, you should use operation "http://tizen.org/appcontrol/operation/main" for your appControl. Otherwise, your app will restart, not just waking up.