Is compute() called for a datafield when not shown on current data screen?

If a datafield is installed in an activity, but not currently shown on the data screen being shown, is compute() still called?

  • Pretty sure that it is, otherwise data fields that compute lap or activity average data (for example) would not work, as well as any data field that is supposed to record measured and/or computed data to a FIT file (once per second).

    You could verify this by writing a simple data field that increments a counter by one every time compute() is called, and returns the value of the counter.

    Then test as follows:

    Navigate away from the data screen, wait 10 seconds, and navigate back. See if the counter increments by 10 or by 1.

    You could also try to validate this without writing your own app.

    1) Download and install the AppBuilder 5 Connect IQ data field

    2) Use the following setting:

    Formula: SUM(1)

    (You'll have to take my word that this will increment the displayed value by 1 every time compute is called, roughly once per second. The starting value would be 1)

    3) Do the test suggested above

  • compute() is always called about every second (it may not be exactly every 1000ms) in a DF. even if the DF isn't visible