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

Create reminder app

What is the best way to create a reminder app for Fitbit versa. 

First thing, is it possible at all in Fitbit ecosystem, given the fact that companion is running in mobile device and is dependent on Mobile OS to keep the app running in background.

 

For example, I Tried below companion code from Fitbit developer forum. I could not seem to get it work, console log shows only for the first time 5 mins after launch, but not after next 5 minutes.

 

(Also is there any way In developer mode to reduce the standard wakeInterval duration. Because while developing/testing waiting 5 minutes is a-lot, Would like to do quick build-test tries )

 

Thanks for any help 🙂

 

import { me as companion } from "companion";

if (!companion.permissions.granted("run_background")) {
console.warn("We're not allowed to access to run in the background!");
}

const MILLISECONDS_PER_MINUTE = 1000 * 60;

// Tell the Companion to wake after 5 minutes
companion.wakeInterval = 5 * MILLISECONDS_PER_MINUTE;

// Listen for the event
companion.addEventListener("wakeinterval", doThis);

// Event happens if the companion is launched and has been asleep
if (companion.launchReasons.wokenUp) {
doThis();
}

companion.onwakeinterval = evt => {
console.log("Companion was already awake - onwakeinterval");
doThis();
}

function doThis() {
console.log("Wake interval happened!");
}

Best Answer
0 Votes
4 REPLIES 4

I don't think the wake interval can be reduced below the minimum. I think it has to be this way to prevent the operating system from killing things to save battery use.

 

The harder problem is how to notify the watch user. Apps can't run on the background on the watch, nor can they be started from the companion. The companion API doesn't provide methods for sending notifications (like what happens with SMSs).

Peter McLennan
Gondwana Software
Best Answer

Thanks Peter,

So ok there isn't any way at the moment to create reminder like apps for Fitbit given the fact that, niether companion app nor app in watch can run in background or wake at intervals. Cheers

Best Answer
0 Votes

Hello vijeth,

 

I have a task that I fire hourly, but it is as part of a watchface. As Gondwana said there is no background tasking and it does not appear it will ever be an option.

 

I do understand as doing such opens up a whole new class of potential security vulnerabilities.

 

On the other hand, if you are willing to write a whole new watchface to support your app, it is possible.

 

In practice, I still have to check if events have passed while something else ran, and I do have to restart interval timers on restart as well; as a watchface you pretty much own the foreground, but you do have to account for when your app is displaced, even momentarily.

 

Regards,

Reign

 

Best Answer
0 Votes

Thanks Reign, appreciate the detailed answer. Cheers

Best Answer
0 Votes