Languages

Menu
Sites
Language
Sometimes app breaks down during switching to ambient mode (always on display) Gear S3. 2.3.2

My watch face updates time every 500 ms in both modes ambient and regular. Updating time is stopped when document is hidden. So I did this:

document.addEventListener("visibilitychange", function() {
if (!document.hidden) {
interval = setInterval(update_watch, 500);


if (document.hidden) {
clearInterval(interval);
}
});

Everything works fine when I test the app but when I disconnect a device from Tizen Studio and leave my Gear S3 for a while the app breaks down. Watch updates time only in regular mode and doesn't update time in ambient mode! Besides not working time updating during ambient mode the watch seems to be freezed. For example I have heart rate measuring, so app measures heart rate during 20 seconds and turns off measuring if data isn't got earlier. When watch is swithed to ambient mode time updating is stopped and the app measures heart rate infinitely! (*Heart rate measuring works perfect in regular mode*)

I don't know what is a reason. I tried a lot of cases but the result is always the same. It makes no sense because if the code is wrong it shouldn't work at all. I'm going crazy! :))))
I think it's it's something because of energy saving!

Please, help! )))

Edited by: Anonymous on 03 May, 2019

Responses

4 Replies

I've been testing this @(#%^ for several hours and I've found out that everythink works great only if my Gear S3 connected to Tizen Studio!!! When I disconnect it doesn't work!
Now I have one more problem. Heart rate measuring doesn't stop to measure. It's the SAME WHAT KILLS my app when it goes into ambient mode.... Nothing helps! 
background-support="enable"
http://tizen.org/privilege/alarm
http://tizen.org/privilege/power
tizen.power.request("CPU", "CPU_AWAKE");

it's insane!!!
 

Yes, the problem is with device connection to Tizen Studio. When Gear S3 is connected everything works. Probably it's some kind of debug mode which doesn't allow Gear to fall asleep, so it works great. But in other cases when Gear S3 is disconnected it breaks down, so it's really hard to test!

I refused using time updating every 500 ms during ambient mode and decided to use timetick updating every 1 min. It's not the same, because I wanted to make blinked ":" between hours and minutes. So if someone knows how to make blinked ":" every 1000 ms/500 ms during AMBIENT MODE, please help!

Also I remade heart rate measuring because it had been measuring infinitely by reason of killing the process when both watch screen was turning off and ambient mode was switched on.

If it's impossible to continue measuring when both screen is turned off and watch turns on ambient mode I won't use it! So I've added turning off measuring if screen is OFF! Heart rate will be measured when a users uses his watch and it can measure without breaking down! I hope my experience will be helpful for someone!

I used tizen.power.setScreenStateChangeListener(onScreenStateChanged);

tizen.power.setScreenStateChangeListener(function(previousState, changedState) {
    if (previousState === "SCREEN_NORMAL" && changedState === "SCREEN_OFF") {
        tizen.humanactivitymonitor.stop("HRM");
    }
    if (previousState === "SCREEN_OFF" && changedState === "SCREEN_NORMAL") {
        hrm_start();
    }
});

 

Yep, it's my post too ;)