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

sideloading app sense 2

ANSWERED

I am trying to build and install an app I wrote on my new sense 2.  I can now build the app, but I can't get the app to install as I can't connect to the device.  I am using sdk 7.2.0-pre.0 and sdk-cli 1.8.0-pre.11 under linux. 

I may need some help configuring the ttyACM0 interface with the cdc_acm driver.  (I don't think I've done this part properly and this is the reason I can't load the app.)

All my google searches indicate that it is not possible to sideload an app on the sense 2.  Has anyone done this successfully?

The steps I've taken ...

$ npm i @Fitbit/sdk

$ npm i @Fitbit/sdk-cli

$ npx fitbit

Logged in as Chris Gorman <email_address>
fitbit$ build

> fitbit-planets@0.0.4 build /home/chris/src/javascript/fitbit-planets
> fitbit-build

[05:07:01][warn][companion] This project is being built without a companion component. Create a file named companion/index.ts or companion/index.js to add a companion component to your project.
[05:07:01][warn][settings] This project is being built without a settings component. Create a file named settings/index.tsx, settings/index.ts, settings/index.jsx or settings/index.js to add a settings component to your project.
[05:07:04][info][app] Building app for Fitbit Sense 2
[05:07:04][info][app] Building app for Fitbit Versa 4
[05:07:04][info][build] App UUID: uuid, BuildID: build_id

$fitbit connect phone

Auto-connecting only known phone: Samsung Model

fitbit$ connect device
No devices are connected and available

And this is where I'm stuck.  Anyone with any ideas?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @chrisjohgorman - you may be able to install a USB driver but there are some simpler solutions.

First develop for a Sense and use the simulator to debug.

Then build the project for the Sense 2 and add it to your GAM project.

Then click the link at the top which will open it in the browser and click OPEN APP to install it on the watch using the private link.

In some cases there can be incompatable features and it may crash but without proper documentation it will be hard to debug.

Author | ch, passion for improvement.

View best answer in original post

Best Answer
0 Votes
16 REPLIES 16

@chrisjohgorman  I moved your post to the SDK Development forum, a better fit for your question.  I think you will get a faster response here.

Community Council Member

Laurie | Maryland, USA

Sense 2, Luxe, Aria 2 | iOS | Mac OS

Take a look at the Fitbit help site for further assistance and information.

Best Answer
0 Votes

Hi @chrisjohgorman - you may be able to install a USB driver but there are some simpler solutions.

First develop for a Sense and use the simulator to debug.

Then build the project for the Sense 2 and add it to your GAM project.

Then click the link at the top which will open it in the browser and click OPEN APP to install it on the watch using the private link.

In some cases there can be incompatable features and it may crash but without proper documentation it will be hard to debug.

Author | ch, passion for improvement.

Best Answer
0 Votes
Hello List,

I just wanted to document here how it is possible to sideload an app
for a Sense 2 or Versa 4 under linux. The best information on how to
accomplish this is available at
https://github.com/cmengler/fitbit-app-versa4 . This allows for
testing my app on my phone, which is necessary. Just follow all of
cmengler's instructions and you can build and install apps on your
watch.

Thank you @Guy_(Space Racer) for your suggestions too.

Take care,

Chris
Best Answer

Hello List,

I just tried to debug my install of the app I've written.  When I select a menu entry I get the following ..

[10:07:03][info][build] App UUID: appid, BuildID: 0x04d8437846df7411
No app package specified. Using default ./build/app.fba.
Loaded appID:appid buildID:0x04d8437846df7411
App install complete (full)
Launching app
RPCError: App terminated
at Peer.handleError (/home/chris/src/javascript/fitbit-planets/node_modules/@fitbit/jsonrpc-ts/lib/peer.js:316:24)
at Peer._write (/home/chris/src/javascript/fitbit-planets/node_modules/@fitbit/jsonrpc-ts/lib/peer.js:250:26)
at writeOrBuffer (internal/streams/writable.js:358:12)
at Peer.Writable.write (internal/streams/writable.js:303:10)
at StreamTap.ondata (internal/streams/readable.js:731:22)
at StreamTap.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at StreamTap.Readable.push (internal/streams/readable.js:206:10)
at StreamTap.Transform.push (internal/streams/transform.js:166:32)

This is using "@fitbit/sdk": "^7.2.0-pre.0", "@fitbit/sdk-cli": "^1.8.0-pre.11" and "@fitbit/sdk-build-targets": "cmengler/fitbit-sdk-build-targets" and is develped for "rhea".  When I develop for vulcan, I get "proper" output.

Loaded appID:appid buildID:0x07059a4296106cb6
App requires a device, connecting...
Auto-connecting only known device: Versa 3 Simulator
App install complete (partial)
Launching app
[10:15:59 AM] App: App Closed
[10:15:59 AM] App: App Started
[10:15:59 AM] App: Launch complete - durations: foregrounding(73ms), first paint(30ms), total(528ms).
[10:16:04 AM] App: sun clicked (app/views/sun.js:10,3)
[10:16:04 AM] App: Latitude: 48.13194 (app/views/sun.js:16,3)
[10:16:04 AM] App: Longitude: 11.54944 (app/views/sun.js:16,3)
[10:16:04 AM] App: sun RA: 16.2120 (app/views/sun.js:54,3)
[10:16:04 AM] App: sun Decl: -21.1492 (app/views/sun.js:55,3)
[10:16:04 AM] App: sun Dist: 0.9868 (app/views/sun.js:56,3)
[10:16:04 AM] App: sun azimuth: 236.7135 (app/views/sun.js:57,3)
[10:16:04 AM] App: sun altitude: 0.4222 (app/views/sun.js:58,3)

Does anyone know how to fix this?

Thanks in advance,

Chris

Best Answer
0 Votes

@chrisjohgorman- Just in case you are reinventing the wheel check here

Author | ch, passion for improvement.

Best Answer
0 Votes
Hi @Guy_,

I may indeed be building an app that doesn't have the features yours
does. It looks beautiful, you must have spent some time on it. I'm
trying to rebuild an app that I had on my Versa 1, which died on me.
(The screen got ripped off of it.) The code is available at
https://github.com/chrisjohgorman/fitbit-planets .

I've tried to rebuild it with the model of sdk-app-demo.
Unfortunately, both my app and the sdk-app-demo die in the same way
when run on the Sense 2. (Which is my replacement for the Versa 1.)
I'm poking around to see if I can work around the error, but I'm not
sure I can.

Thanks for the link, and when you port your app to Sense 2, I may try it.

Take care,

Chris
Best Answer

@chrisjohgorman- unfortunately I think it is why Fitbit stopped porting clock faces to the Sense 2/Versa 4 as too many were crashing, yours might just be another example. Why the SDKs are not compatible is a mystery and probably why the new SDKs were never released. In short what runs on a Sense/Versa 3 but doesn't on a Sense 2/Versa, is what it is at this stage without more assistance from Fitbit.

Author | ch, passion for improvement.

Best Answer
@Guy_,

I can probably get my old interface to work with the unreleased SDK.
The new one, was modeled after sdk-app-demo which does some magic (I
know just enough javascript to get in trouble.) to load separate js
files. I think this is what is crashing. But as you say, without
help from Fitbit, I may not be able to get the new one working.

Thanks for the pointers.

Chris
Best Answer

There's a small chance that a slow-to-start app will be killed before it achieves consciousness. I've had occasional success by maxing the screen timeout in the watch's Settings app, as though the allowed start-up time were linked to that.

To further test this theory/superstition, try bypassing lengthy start-up routines just to see if it makes and difference.

Peter McLennan
Gondwana Software
Best Answer
0 Votes
Hi @Gondwana,

Thanks for the suggestion. Unfortunately, it didn't fix the error.

I haven't actually traced it out yet, but my suspicion is that the
error lies in the following function.

buttonCallbacks.forEach((view) => {
const [buttonID, viewJSLoader] = view;

document.getElementById(buttonID).addEventListener("click", () => {
viewJSLoader().then(({ init, update }) => {
init().then(update).catch((err) => {
console.error(`Error loading view: ${err.message}`);
});
}).catch((err) => {
console.error(`Failed to load view JS: ${buttonID} - ${err.message}`);
});
});
});


I don't know javascript enough to decipher this function but I think
it's basically the helper function that launches all the other js
files. The reason I suspect this one is that it is basically all
there is in the sdk-app-demo/app/index.js file. The app loads
properly and the first screen with all the tile-lists. Once I select
a tile, I get the crash. This doesn't happen if I load it in the OS
Simulator when I build it for vulcan or atlas.

I will look into the sdk-app-demo app to see if I can get an older
version that works without this function.

Thanks for your help.

Chris
Best Answer

I checked out git commit a1899d23585ed24786b80bd0d3683a4e16952fa7 of the sdk-demo-app and built it and it runs "properly".  (For the one test I've preformed.)  I will work at moving my from "per scenario files" to one monolith as it was done in the initial release.  A bit of a shame as I liked the nice way the per scenario files breaks up the work for my app.  Hoping this is a step in the right direction.

Take care and thanks for all the help.

Chris

Best Answer

While I'm still only guessing at the issue, I'd still be careful with start-up time. You don't get much of it. I do like the idea of per-scenario modularity. Maybe consider if you can implement the concept of 'lazy loading'.

Peter McLennan
Gondwana Software
Best Answer

I will try to implement 'lazy-loading'.  I will have the initial screen and load and the selected button load on "click".  At least that's how it worked in the past.  We'll see what I get as I progress.  Thanks both @Gondwana and @Guy_ for the advice and @LZeeW for sending me to this list.

Chris

Best Answer

Hiya,

Just wondering if a music app can be added by sideloading apps?

Thanks!

Best Answer
0 Votes
Hi @Rose9119,

Sideloading is the process of loading an app from the development
environment to the watch. An app is built in the development
environment and then "sideloaded" to the watch. So, can this be used
to load a music app? I suspect so, although I have not tried anything
like that. My app was a simple app for determining the positions of
the planets and only accessed the GPS location from the companion
operating system on my phone. To make music work, I suspect you would
need to access the bluetooth hardware on the watch to get it to "pair"
with your headphones. Then you would need some form of mp3 player and
finally storage space for your mp3 files. I am not aware of any app
that does these things, but you could write one.

Christian Mengler wrote an app to get some form of spotify working on
the Versa 4. (see
https://github.com/cmengler/fitbit-spotify-hr-versa4 ). I don't know
if that is the type of thing you're looking for or not, but it would
be where I would start if I wanted music on the watch.

Hope this helps. Take care,

Chris
Best Answer
0 Votes

In practice, I don't think so. The public API doesn't provide access to Bluetooth or any other way of playing audio. I think that previous audio apps were developed in partnership with Fitbit and made use of APIs that mere mortals can't access.

You might be able to sideload such an app if you could get the .fba for it, but I don't think that's possible.

Peter McLennan
Gondwana Software
Best Answer
0 Votes