Can't change minimum SDK

I have been working on a watch face to show UTC time only. All going OK until I tried testing it on my own type of watch (Forerunner 45) in the emulator, at which point the compiler complained that it suddenly didn't recognise the utcInfo method of the Gregorian class.

Checking the documentation I saw that this method was only supported from SDK version 2.1.0 onwards. When selecting the Forerunner 45 for the emulator, I noticed that it was defaulting to SDK 1.4. I tried clicking on the SDK dropdown at this point but it gave me no other options. I opened up the manifest and changed the minSdkVersion to 2.1.0, but when I tried to run again it still gave me no option for  the F45 other than 1.4.

I checked my own watch - it says it has software version 3.9, so it's clearly not the case that this watch only uses v1.4.

Anyone any idea what I'm doing wrong and how to fix this?

Regards,

Michael

Top Replies

  • I checked my own watch - it says it has software version 3.9, so it's clearly not the case that this watch only uses v1.4.

    As Jim said, the watch firmware version (3.9) isn't the same…

All Replies

  • The fr 45 runs CIQ 1.x and per the API doc, utcinfo is

    Since: 2.1.0

    The fr45 doesn't support utcinfo

    the main FW version, 3.90, does not equate to the CIQ version

  • I checked my own watch - it says it has software version 3.9, so it's clearly not the case that this watch only uses v1.4.

    As Jim said, the watch firmware version (3.9) isn't the same as the Connect IQ / SDK version (1.4).

    Forerunner 45 is limited in several ways compared to other watches. For example, it only supports watchfaces and not other kinds of CIQ apps (device apps, widgets and datafields).

    If you look in your ConnectIQ devices folder (*), and look at the fr45\compiler.json file (search for connectIQVersion), you'll see that the watch is stuck on Connect IQ 1.4.5. I'm guessing the reason is to save memory, as FR45 also has less memory for watchfaces then other contemporary watches. (That allows Garmin to cut costs, I guess.)

    (*) On windows: %APPDATA%\garmin\connectiq\devices

    Maybe you can use System.ClockTime.timeZoneOffset and Gregorian.info() to derive the same information as Gregorian.utcInfo()?

    (Create a Moment representing the local time/date you want to represent as UTC, then create a Duration from the time zone offset and subtract it from the Moment. Use the result with Gregorian.info())

  • For example, this worked for me:

    using Toybox.System;
    using Toybox.Time;
    using Toybox.Time.Gregorian;
    
    // replacement implementation for Gregorian.utcInfo()
    function utcInfo(moment, format) {
        var timeZoneOffset_duration = new Time.Duration(System.getClockTime().timeZoneOffset);
        var utc_moment = moment.subtract(timeZoneOffset_duration);
        return Time.Gregorian.info(utc_moment, format);
    }
    
    // Rest of the code is a proof-of-concept / test case:
    // get current UTC time as string (e.g. "20:30:40 Sat 27 Feb 2021")
    function getCurrentUTCTimeString() {
        var now = Time.now();
        var now_info = utcInfo(now, Time.FORMAT_MEDIUM);
        var dateString = Lang.format(
            "$1$:$2$:$3$ $4$ $5$ $6$ $7$",
            [
                now_info.hour,
                now_info.min.format("%02d"),
                now_info.sec.format("%02d"),
                now_info.day_of_week,
                now_info.day,
                now_info.month,
                now_info.year
            ]
        );
        return dateString;
    }

  • Thanks guys. I'll give that a go and let you know how I get on.

  • Yes, that did the trick nicely, thanks. Slight smile