4.1.0 Beta features not working with Simulator - what am I doing wrong?

Hi,

I am trying to add a Body Battery graph to my watch face for 4.1.0 Beta.

I have a working Heart Rate graph, so I thought it would be a simple matter to copy that but...

On the Simulator I can get the Body Battery History and I can even iterate through it, so long as I don't try and read it.

The following section of code works:       

        var bbIterator = ActivityMonitor.getBodyBatteryHistory();
        var sample;

        if(ActivityMonitor has :BodyBatteryData) {
            do {
                sample = bbIterator.next();
                System.println("sample: " + sample);
            } while(sample != null);
        }
It produces the following output:
    20 sample: Obj: 175
sample: null
However, this does not:
        var bbIterator = ActivityMonitor.getBodyBatteryHistory();
        var sample;

        if(ActivityMonitor has :BodyBatteryData) {
            do {
                sample = bbIterator.next();
                System.println("sample: " + sample.bodyBattery);
            } while(sample != null);
        }
It produces the following output:
    Error: Symbol Not Found Error
    Details: Could not find symbol 'bodyBattery'
Yet in the debugger there is:
Which looks rather odd...
Dare I try it on my watch?
Many thanks,
Paul
  • I tried in on my Venu 2 and it failed because of a bug in my code.

    Fixed code is:

            if(ActivityMonitor has :BodyBatteryData) {
                var bbIterator = ActivityMonitor.getBodyBatteryHistory();
                var sample;
           
                DebugController.println(DebugController.LEVEL_HIGH, "Has Body Battery");
         
                do {
                    sample = bbIterator.next();
                    DebugController.println(DebugController.LEVEL_HIGH, "sample: " + sample.bodyBattery);
                } while(sample != null);
            } else {
                DebugController.println(DebugController.LEVEL_HIGH, "No Body Battery info");

            }

    Which gives:

    15:48:49: No Body Battery info

    The watch has the following:


    Firmware-Version: '8.11'
    Language-Code: eng
    ConnectIQ-Version: 4.1.0

    Many thanks,

    Paul

  • I have the same problem. Did you manage to fix it?

  • From my user feedback

    • Device Name: Venu 2 Plus
    • Firmware Version: 8.12

    in his system about is

    Firmware logiciel :8.12
    Connect iq: system 5
    so
    1. BB not working on sim
    2. probably working on 8.12 but I can't test it