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

Utilizing the home button as a "back" button on versa

I'm creating a list app using the Tile View. Each tile is a button that leads to another page, and I want an option to go back to the tile view without making an on screen button. How can I do that?

Best Answer
0 Votes
3 REPLIES 3

@Bragol wrote:

I'm creating a list app using the Tile View. Each tile is a button that leads to another page, and I want an option to go back to the tile view without making an on screen button. How can I do that?


You can't intercept the physical buttons, they belong exclusively to the Fitbit OS.

 

You don't have to respond to a specific button though. My top SVG gui element is always called mPage, and I respond to the mouse up event for that.

 

<svg id="mPage" viewport-fill="#000000" pointer-events="visible">
... page elements ...
</svg>

 

 

 

function om(evt){return Math.floor(2*evt.screenX/device.screen.width)+2*Math.floor(2*evt.screenY/device.screen.height)}

var mArm
document.getElementById('mPage').onmousedown = evt => {
  mArm=om(evt)
}
document.getElementById('mPage').onmouseup = evt => {
  var clickPos=om(evt)
  if (clickPos==mArm){
    switch (clickPos){
      // Touch handlers
    }
  }
}

 

It effectively gives the X,Y position of where the user has touched the screen.

One of my alternate pages simply responds to any mouse interaction by returning to the main page.

 

Regards,

Reign

Best Answer
0 Votes

I've seen various apps (Fitbit Labs "Treasure Tracker", "PokeLab SW/SH") use pressing the home button to navigate to qa previous screen though. (Treasure tracker uses a panorama view, home button resets to the leftmost section, Pokelab uses it to return to the main list after viewing an entry, and to exit a tumbler view), though. All of these actions replaced going back to the home screen. 

Best Answer
0 Votes

It may be that I don't fully understand your issue, but there does seem to be a way to respond to the physical back button within your app as is shown in a Fitbit multi-view sample app on GitHub. On the following page, this code can be seen in the view-2.js and view-3.js files under the app and views directories: https://github.com/Fitbit/sdk-multi-view

Best Answer
0 Votes