Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

App cannot run in background

ANSWERED

Hey there Fitbit developers.

I am currently getting my heart rate in real time and keep sending it to my smart phone.

However, when the screen is turned off due to time passing, the App stops working.
(Communication with Companion will not be confirmed).

Of course, I have tried the following code, but it does not show any effect.

import { me } from "appbit";
//Make sure it works even when the screen is off.
me.appTimeoutEnabled = true;
console.log(me.appTimeoutEnabled); # output is "true"

Why is it not working?

Also, if a measure that does not turn off the screen might solve the problem, I would like to know how to do that as an alternative.

Sorry for the beginner's question, but thank you in advance.


Reference.

The watch is versa2

The phone is android

SDK version is 4.3

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

setInterval

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
0 Votes
8 REPLIES 8

true means that the timeout is enabled. You want false.

Peter McLennan
Gondwana Software
Best Answer

@Gondwana Thanks for the answer!!! I am ashamed of my elementary mistake.

 

However, even if I set the relevant section to False, it still does not work. Do you know why?

Best Answer
0 Votes

Does your app keep running, or does the watch close it and return to a clockface?

When the display is off, you won't get clock tick events even if your app is still running.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

@Gondwana  

In those two options, it seems that the APP continues to run even when the screen is closed, not back to the clock screen.

I see, that makes a lot of sense. I am now using clock tick events to send data every second.

Is there any other way to make it behave the same way when I close the screen? Or how not to make the screen turn off: ....

Best Answer
0 Votes

setInterval

Peter McLennan
Gondwana Software
Best Answer
0 Votes

@Gondwana 

Thank you! You solved everything I was having trouble with!

Best Answer

How do I keep my Fitbit running in the background, every time I come off my fitbit app on my phone, I can't use Alexa please help

Best Answer
0 Votes

@ToshkimThis doesn't sound like an SDK question. I can move your question to the Android/iOS forum; which is appropriate?

Peter McLennan
Gondwana Software
Best Answer
0 Votes