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

Announcing Fitbit OS 2.0 and Our Brand New Simulator!

Introducing the latest awesome offerings for Fitbit developers: Fitbit OS 2.0 and our new multi-device simulator. Developers can now rapidly build applications and clock faces for Fitbit Ionic and the new Fitbit Versa, without having to purchase a device.

 

https://dev.fitbit.com/blog/2018-03-13-announcing-fitbit-os-2.0-and-simulator/

 

Best Answer
49 REPLIES 49

@AmbientPower: some things are just easier to test on a real device, but feel free to add a request for this.

Best Answer

Hey Fred, while you are at it, what's the status of the other requests there?
From the outside everything look pretty stale.

Best Answer

@paperinik: which ones?

Best Answer
0 Votes

Besides the emulator, all feature requests related to SDK look pretty much stale: https://community.fitbit.com/t5/Feature-Suggestions/idb-p/features/label-name/sdk

I would be interested in being able to send messages to the companion (push vs. pull): https://community.fitbit.com/t5/Feature-Suggestions/add-support-for-listening-to-a-port-in-companion...

But the platform would make a GIANT step when:

  1. we are able to run code in background; right now the only possibility is via watch face, but that's not even 100% true when an app is in foreground;
  2. improve our ability to debug; right now this is secondary as the SDK is not that "powerful" to require this. In this category I would put github integration, CLI tools, etc.
  3. detect sleep; it would be awesome to be able to detect an approximate sleep stage, but even "the user is sleeping/awake" might be good enough for some purposes. See here: https://community.fitbit.com/t5/SDK-Development/Sleep-status/m-p/2618449#M3631
  4. ability to run arbitrary graphic (not affecting me personally, but I think this is a strong platform limitation)

Of course sending a message to a companion and avoid polling is my number one request. I believe I already mentioned it. 😛
Pardon me bothering, but you guys are our only interface with the product team which so far seems pretty impervious to even extremely popular outstanding user requests.

Best Answer

Is there a video tutorial for this? I am trying to create my own personal clock face with a picture on my versa.

Best Answer
0 Votes
There are no video tutorials (that I know of), but any questions you have will get answered on here pretty quickly.
Best Answer
0 Votes

Hello @SunsetRunner

My first steps were with this excellent tutorial at udemy. Worth spending few bugs.

https://www.udemy.com/fitbit-ionic/learn/v4/t/lecture/9280866?start=268

Best Answer
0 Votes

Thanks for the work on this and all the dev tools.

 

Quick question: Is 'fetch' from the Companion API implemented in the Simulator? It seems like it is not, or at least, it is not working on my system.

 

EDIT: Upon further testing, it seems that 'messaging.peerSocket' never opens. The event handler 'messaging.peerSocket.onopen' never fires from within an App running on the Simulator. So there was no message sent to tell the companion to 'fetch' in the first place.

 

So my revised question: Is messaging implemented between the OS and Phone Simulators?

 

EDIT EDIT: Thanks to a helpful citizen on the Discord (@cpf) I resolved the issue. The Simulator opens the socket so fast that the event handler does not have time to attach before the event fires. So now I just check if the socket is already open and manually trigger the handler. Works like a charm.

 

Thanks for all your hard work!

Best Answer
0 Votes

@JonFitbit thanks! I look forward to playing around with the SDK and emulator over the next few months! 

Best Answer
0 Votes

I experienced significant performance issues with the supplied monospace conversion script. I have come up with one which does monospace + padding far more efficiently:

// Convert to a string containing monospace digits
export function monoDigits(num, pad = true) {
num |= 0; if (pad && num < 10) { return c0 + monoDigit(num); } else { let monoNum = '' while (num > 0) { monoNum = monoDigit(num % 10) + monoNum num = (num / 10) | 0 } return monoNum } } const c0 = String.fromCharCode(0x10); const c1 = String.fromCharCode(0x11); const c2 = String.fromCharCode(0x12); const c3 = String.fromCharCode(0x13); const c4 = String.fromCharCode(0x14); const c5 = String.fromCharCode(0x15); const c6 = String.fromCharCode(0x16); const c7 = String.fromCharCode(0x17); const c8 = String.fromCharCode(0x18); const c9 = String.fromCharCode(0x19); function monoDigit(num) { switch (num) { case 0: return c0; case 1: return c1; case 2: return c2; case 3: return c3; case 4: return c4; case 5: return c5; case 6: return c6; case 7: return c7; case 8: return c8; case 9: return c9; } }




Best Answer

@buzuli wrote:

I experienced significant performance issues with the supplied monospace conversion script. I have come up with one which does monospace + padding far more efficiently:


That's great, mind if I replace our example with yours?

Best Answer

Feel free to use it as your example. Keep in mind that it will coerce the supplied number to an integer.

 

The updateClock function in the example will need to be updated to the following.

function updateClock() {
  var today = new Date();
  var hours = util.monoDigits(today.getHours(), false);
  var mins = util.monoDigits(today.getMinutes());

  myLabel.text = hours + ":" + mins;
} 

 

Best Answer
0 Votes

Here is an updated version which can be applied to strings also:

export function monoDigits(num, pad = true) {
  let monoNum = '';

  if (typeof num === 'number') {
    num |= 0;
    if (pad && num < 10) {
      monoNum = c0 + monoDigit(num);
    } else {
      while (num > 0) {
        monoNum = monoDigit(num % 10) + monoNum;
        num = (num / 10) | 0;
      }
    }
  } else {
    let text = num.toString();
    let textLen = text.length;
    for (let i = 0; i < textLen; i++) {
      monoNum += monoDigit(text.charAt(i));
    }
  }

  return monoNum;
}

const c0 = String.fromCharCode(0x10);
const c1 = String.fromCharCode(0x11);
const c2 = String.fromCharCode(0x12);
const c3 = String.fromCharCode(0x13);
const c4 = String.fromCharCode(0x14);
const c5 = String.fromCharCode(0x15);
const c6 = String.fromCharCode(0x16);
const c7 = String.fromCharCode(0x17);
const c8 = String.fromCharCode(0x18);
const c9 = String.fromCharCode(0x19);

function monoDigit(digit) {
  switch (digit) {
    case 0: return c0;
    case 1: return c1;
    case 2: return c2;
    case 3: return c3;
    case 4: return c4;
    case 5: return c5;
    case 6: return c6;
    case 7: return c7;
    case 8: return c8;
    case 9: return c9;
    case '0': return c0;
    case '1': return c1;
    case '2': return c2;
    case '3': return c3;
    case '4': return c4;
    case '5': return c5;
    case '6': return c6;
    case '7': return c7;
    case '8': return c8;
    case '9': return c9;
    default: return digit;
  }
}
Best Answer
0 Votes

@SunsetRunner, @JonFitbit

another month has gone by without news on requests filed 6+ months ago.

Out of curiosity: what the heck is the product team working on? 🙂

Best Answer
0 Votes

@paperinik

They created a public roadmap.

https://dev.fitbit.com/build/roadmap/

The set of goals outlined in the roadmap seems reasonable. It reflects my suggestions on 100%, so no complaints from me :).

Best Answer

@paperinik wrote:

@SunsetRunner, @JonFitbit

another month has gone by without news on requests filed 6+ months ago.

Out of curiosity: what the heck is the product team working on? 🙂


https://community.fitbit.com/t5/Versa/Versa-Firmware-Release-32-32-10-15/td-p/2690045 Man Wink

Best Answer
0 Votes

@JonFitbit Thanks so much! This has sped up the development process big time!

 

The only issue I'm dealing with is my app works well on the Simulator and not my actual watch. Feel free to take a look at my post: https://community.fitbit.com/t5/SDK-Development/JSON-Retrieved-and-Processed-in-Fitbit-Simulator-Doe....

 

I'm also starting to wonder if there is something wrong with my Ionic 1st generation watch or phone. (When I select Sync Now it takes a long amount of time and fails very often)

 

Thanks,

-Don

Best Answer
0 Votes

When I launched the simulator on my MacBook Pro running macOS 10.13.4, I got this error:

 

"app" is not optimized for your Mac. This app needs to be updated by its developer to improve compatibility.

 

and it linked to https://support.apple.com/en-us/HT208436 Screen Shot 2018-06-03 at 16.15.33.png

Best Answer
0 Votes

Works fine on mine running 10.13.4, MBP Touch bar.

Embedded developer, www.ambientpower.co.uk
Ukulele stuff, www.coolcatukes.com
Best Answer
0 Votes

I simply don't think you are running the right app. Fitbit OS Simulator is a 64 bit app, not 32 bit.

Embedded developer, www.ambientpower.co.uk
Ukulele stuff, www.coolcatukes.com
Best Answer
0 Votes