Solutions for real time phone communication on older devices.


I have a Garmin Data Field which works with our iOS and Android apps in order to display numerical fitness metrics provided by my company's product. This works well for CIQ 5.0+ devices (x40/x50 gen newer then ~2022). But some users have older devices which I would like to support.

I am using web requests to query my app through the Garmin Connect app on the users phone. My Android app broadcasts to a port on the localhost which Garmin does not restrict. This doesn't require internet access, and although the structure is not majestic it seems fine for my needs.

How can I support real time (once per 5 seconds or better) metric streaming to an older gen bike computer from my Android and iOS apps? It would be nice but not required to work on watches too.

I attempted to implement the message method from the Garmin SDK but I think that might be only for watches not edge computers? Or not for data fields? The API lists function api-docs/Toybox/Communications registerForPhoneAppMessages(method(:phoneMessageCallback)) as supporting edge devices since API 1.4.0. However this function is a syntax error using the Monkey C plugin for VS Code with my settings, and a forum post "On Communications.registerForPhoneAppMessages by Nik over 6 years ago" notes support was removed in API 2.2.2 and maybe never worked. The table for enabled app types (connect-iq-basics/app-types/) declares Toybox.Communications is supported for Data Fields in API 5.0.0+ but this function still does not compile when targeting API 5.0.0 for a Data Field on a Edge 840.


Supplemental technical information:
I marked all bike computers and watches as supported in the manifest.
I test with a Edge 840, or Edge Explore (2018).
iq:manifest version="3"
minApiLevel="3.0.0"
<iq:uses-permission id="Background"/>
<iq:uses-permission id="Communications"/>
<iq:uses-permission id="FitContributor"/>

  • I seem to recall that the earlier edge devices supported BT but not BLE and didn't work with companion apps.  Nothing you can do about that.

  • Depending how old early devices means I’m ok not supporting them. If I could support CIQ 3.0 and higher I would be very happy.

    I have a Edge Explore (2018) with Connect IQ API version 3.1.6 and device software version 5.4 which is able to communicate over BLE to the companion app. But only using a Toybox.Background web request which is limited to one per 5 minutes according to api docs on InvalidBackgroundTimeException.

    I just sanity checked myself and tried using the foreground web request I have for CIQ API 5.0+ using Toybox.System.ServiceDelegate (since 2.3.0). But the data field doesn’t appear to do anything on the Explore when it works with the 840. Most likely it is hitting a error and I am not catching it to print it to the field.

    Do you know of any other methods that might be worth trying?

  • In some older devices, in a data field you can only do comm in a background service.  No way around that or reduce the every 5 minute.  I remember when it changed, but can't find where it was announced, but I changed some of my DFs to do comm in the main app and not the background.  You'll see the same on older watches.

  • Oh I see your point, any and all background communication is limited to once per 5min. 

    I found a note under the overview of Toybox.Communications in the API that says " This module was made available to foreground data fields with API 5.0.0". So I assume that is the point at which foreground requests were added.

    So if I was able to get the fitness data from my company's product in a method that wasn't with the Communications API then I might have different restrictions?

    I understand that sensors are specific in that they only connect to BLE devices broadcasting Bluetooth UUIDs for metrics Garmin supports like heart rate.

    But the Toybox.BluetoothLowEnergy says since 3.1.0, but that doesn't mean it works for everything that old. Unfortunately my company's product does quite a lot of processing on our sensor data which can't be done on the Garmin device. But for anyone else with a similar problem if you can get your data directly over BT / BLE it looks like you wont have the once per 5min restrictions I'm running into. 

    Unless anyone has ideas on another method I'm going to just tell my users we only support newer Garmin devices.