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

*Beginner* How to unbrick my Ionic and to release an App properly?

ANSWERED

Hello guys,

 

i never developed frontend/apps or similar stuff. So first of all, i tought myself javascript/css/.gui/Fitbit Api just enough to get a decent app running properly in Fitbit Simulator. When i tried to flash the app to my Fitbit via developer bridge, the app starts running on my main screen and i don't seem to find a way to kill it. 

What i am asking for in detail:

1. How to kill the app and restore my fitbit without factory reset?

2. How to flash an app that gets it's own app 'logo' and can be started from app menu, just like all the other apps.

3. How to implement to following:

       if( Application == Active):

               --> Return to homescreen, run in background when left button is pressed

               --> Return to homescreen, run in Backgground when top right button is pressed

               --> Reset application, run in foreground when lower right button is pressed

 

Thanks a lot in advance 🙂

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Could it be that you developed a clockface instead of an app? The behaviour you described would seem to suggest that.

 

The change is quite easy; it's a setting in Studio or package.json.

 

To remove a sideloaded (not 'flashed') clockface, I think you can do it from the companion's Fitbit app: open 'Developer', select it from the list of sideloaded things, and 'Delete'/'Remove'. If that doesn't work, try to select another clockface from the Fitbit app.

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
11 REPLIES 11

Could it be that you developed a clockface instead of an app? The behaviour you described would seem to suggest that.

 

The change is quite easy; it's a setting in Studio or package.json.

 

To remove a sideloaded (not 'flashed') clockface, I think you can do it from the companion's Fitbit app: open 'Developer', select it from the list of sideloaded things, and 'Delete'/'Remove'. If that doesn't work, try to select another clockface from the Fitbit app.

Peter McLennan
Gondwana Software
Best Answer

Thanks a lot, worked like a charm 🙂

Yet i have one more question. If i start the app, everythings works alright. If i leave the app and reopen, the application just restarts. I would like to keep the app in Ram and keep my timers alive, even if i exit to desktop. I already checked the box "run in background".

Any idea? 

 

And one more low prior question, do you know how to set a picture as app picture?

Best Answer
0 Votes

Your app/clockface can't stay running if the user opens another app. If you need to be able to resume it from its previous state, you'll need to save that state when it closes (or before) (eg, in onunload), and reload the state (if it exists) when the app restarts.

 

'Run in background' applies to the companion only, I think.

 

The 'app picture' is an 'icon'.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Does safe/restore mean save to filesystem .csv and reload? Or is there any inbuild functionality 'if(action == leaveApp) snapshot;'? 

Best Answer
0 Votes

Alas, there's no built-in shortcut. You're on the right track with filesystem .csv (or .cbor, which is faster and takes less memory and file space).

 

I think there's a package on github that you could splice into your app to do it, or see how it's done. I just do it the hard way; ie, writing my own code. 🙂

Peter McLennan
Gondwana Software
Best Answer
0 Votes

sounds good, i will try to implement .cbor restore routine and upload my final app version to github. Yet i can't figure out how where 'icon' is and how to add it. Is it a menu option or do i have to implement via .gui?

Best Answer
0 Votes

btw are there any big open source projects using javascript to mess around with? I would like to see how other people handle .gui, .css. For me, starting with fitbitos feels very hart.

Best Answer
0 Votes

Search for 'icon' here. There's more somewhere, but that should suffice.

Peter McLennan
Gondwana Software
Best Answer

Fitbit's official github respository is here. Many third-party developers have also made stuff available on github. There may be a partial list of such things on the Fitbit site.

Peter McLennan
Gondwana Software
Best Answer

I just tried to implement cbor but got a little bit stuck for the last 30 minutes. I tried to check if there is a file to read already. If there is a file, read it. If data is obsolete, replace it. If there i no data, create data.

Unfortunately i always get the error 'Unhandled Error: failed to pre-parse snapshot' when i attempt to run it. Did i use cbor wrong? 

function isSnapshotObsolete(snapshotDate) { 
var currDate = new getDay();
if (currDate > safeDate) {
return true;
}
return false;
}

day = new getday() try{ let snapshot = fs.readFileSync("snapshot.txt", "cbor"); if (isSnapshotObsolete(snapshot.time)){ let snapshot = { "day": day, "shortDayFinishHr": shortDayFinishHr, "shortDayFinishMin": shortDayFinishMin, "normalDayFinishHr": normalDayFinishHr, "normalDayFinishMin": normalDayFinishMin, "longDayFinishHr": longDayFinishHr, "longDayFinishHr": longDayFinishHr, }; fs.writeFileSync("snapshot.txt", snapshot, "cbor"); } } catch(err){ let snapshot = { "day": day, "shortDayFinishHr": shortDayFinishHr, "shortDayFinishMin": shortDayFinishMin, "normalDayFinishHr": normalDayFinishHr, "normalDayFinishMin": normalDayFinishMin, "longDayFinishHr": longDayFinishHr, "longDayFinishHr": longDayFinishHr, }; fs.writeFileSync("snapshot.txt", snapshot, "cbor"); }

 

Best Answer
0 Votes

Short answer: dunno. Perhaps delete the , in

longDayFinishHr,

 (both place). That's just a wild guess.

Peter McLennan
Gondwana Software
Best Answer
0 Votes