How Do We Simulate Altitude On a Watch Face

Former Member
Former Member
Hi Connectors,

I want to add altitude data to my watch face. I am aware that, for watch faces, altitude data goes only so far as the last altitude read during the last activity using Activity.getActivityInfo().altitude.

Is there a way to simulate this? Nothing stands out in the simulator options. Perhaps import a fit file?

This goes for all the members of the Activity::Info class. The watch face does have access to this class (using SDK 1.2.5) and there is data abound to be accessed, yet, no way to simulate it.

Thanks,
Jeff
  • Former Member
    Former Member over 9 years ago
    Tried that. The function returns 0.00000
  • maybe is bad your code :-)

    //nadmorska vyska
    var vyska = "";
    var jednotky = "";
    if( Acty.getActivityInfo().altitude != null ) {
    if(Sys.getDeviceSettings().elevationUnits == Sys.UNIT_METRIC)
    {
    vyska = Acty.getActivityInfo().altitude.toFloat();
    vyska = vyska.format( "%.0d" );
    jednotky = " m";
    }
    else
    {
    vyska = Acty.getActivityInfo().altitude.toFloat() * 3.2808399;
    vyska = vyska.format( "%.0d" );
    jednotky = " ft";
    }
    }
    else{
    vyska = "No data";
    }
    dc.setColor(color1, Gfx.COLOR_TRANSPARENT);
    dc.drawText(width/2, 50,Gfx.FONT_XTINY, vyska + jednotky, Gfx.TEXT_JUSTIFY_CENTER);
    dc.drawText(width/2, 64,Gfx.FONT_XTINY, "altitude", Gfx.TEXT_JUSTIFY_CENTER);
  • I did a quick test of this, and I'm able to get altitude in the simulator in a watch face. It's crude, but all I did was:

    Sys.println(Toybox.Activity.getactivityInfo().altitude);

    ...inside my onUpdate().

    When I simulate FIT data, I get simulated altitude values. At the very least, this proves the case. I'm not sure about the particulars of your app, so its difficult for me to make more specific suggestions.