Problems for my watch face for vivoactive 3, fenix 6 pro and FR245 only

Hi, I have a watch face in the Garmin connect IQ shop : https://apps.garmin.com/en-US/apps/5e1ebcab-39e4-4686-966c-a8ed6a8ca42c and I get some report from  vivoactive 3, fenix 6 pro and FR245 users for problems. The Vivoactive 3 users say things like "Settings in the app is a blank white page, and it jams up the watch (the buttons and touch screen becomes non-responsive, and the backlight will not turn itself off, draining the battery). Only way to regain function is to do a forced restart and change to another watch face". The Fenix 6 users write that there's an error message appeared in Garmin Connect Android app stating "cannot communicate with watch" and for the FR245 they can't use the settings. All of those problems are not seen in the ERA page and they don't have any CIQ_LOG files in their devices after using it so I can't even get a hint for what causing the problem.

Everything works fine in the Eclipse simulator so it is super weird for me. I couldn't find any errors in my code that will cause problems. Also I can't understand exactly why there are problems with the Vivoactive 3 and fenix 6 pro. There is a floor indicator that I might messed up and caused the problem with the FR245 (that doesn't have floors indicator in it).

I add the full code for the watch face since I believe it might help https://drive.google.com/drive/folders/1kDoljrg9i3dGrfCX_tPcCf-jXLZCL9HV?usp=sharing

I am posting it here since I am clueless. Last time you helped me with the ERA errors but now the errors aren't in ERA at all and I don't have any of these devices to test.

Please help me understand what caused/may cause the problem.

Thank you in advance everyone.

  • onSettingsChanges is a function you put in your AppBase. It will be called if the user changes app settings while your app is running

    Here's one of mine for example

        function onSettingsChanged() {
        	view.MySettings.load();
        	Ui.requestUpdate();
        }

    I save off "view" in getInitialView() (this is a simple watchface)

        function getInitialView() {
        	view=new SLeanView();
            return [view];
        }

  • About the function to read config, I didn't know it was possible and it sounds like a great idea but I didn't understand if you meant to put there all the read configs of the settings so I just want to be sure.

    Yes, I mean put all of the code for reading settings in one function. That function should also save what you read into class variables. Then you can call that function from both initialize and onSettingsChanged. You can also load resources which depend on settings in the same function.

    That way you won't have to do expensive calls to loadResource() or read properties in onUpdate(). I don't think it will help you with your crash, though.

    Thanks for the help and the suggestions!

    No problem! Sorry I deleted my post, but I felt it was just clogging up the thread because I didn't think it will help you with your problem where the app crashes on real devices.

    For anyone else who was reading this thread, I just suggested:

    - Not calling loadResource or Properties.getValue() in onUpdate()

    - Reading all settings in a single function which can be called from either initialize() or onSettingsChanged()

    - Saving settings locally so you can detect whether they changed

    - Only calling loadResource() when necessary (e.g. when a dependent setting has changed)

  • Hey Jim thank you for the explaination I just want to make sure I got the idea right. MySettings is the function to read config and SLeanView is the WatchFaceNameView ? If so, is it ok to use the settings in the following order:

     function initialize()
     ...
     function onLayout(dc as Dc) as Void
     ...
     function onShow() as Void {}
     function MySettings()
     ...
     function onSettingsChanged()
     ...
     function onUpdate(dc as Dc) as Void
     ...
     function onHide() as Void {}
     function onExitSleep()
     ...
     function onEnterSleep()
     ...
     
     

  • MySettings is a class instance of something I use for settings.  load() is a function I have in that class to load the settings.

    You seem to have onSettingsChanged in your view.  You want it in your AppBase class and not the view.

  • I understand that there's a major difference between functions and classes but I have a really hard time trying to figure out how to load the settings besides onUpdate function. How do I create the MySettings class in order to use the load() function to load the settings?

  • Say you have this class with a load() function:

    class Settings {
        function initialize() {
            load();
        }
        
        function load() {
            //load your settings, etc here
        }
    }

    Then in your view's initialize(), you have

    MySettings=new Settings();

    the load function is called when the Settings class is initialized and will be called again if you do MySettings.load().

  • Hey Jim and  I've tried to make it work but all I've managed to get was those errors:

    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:99:  Undefined symbol "view" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:99:  Undefined symbol "MySettings" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:157:  Undefined symbol "C" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:161:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:165:  Undefined symbol "R" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:166:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:168:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:172:  Undefined symbol "R" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:173:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:175:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:179:  Undefined symbol "R" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:180:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:182:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:185:  Undefined symbol "R" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:185:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:187:  Undefined symbol "R" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:188:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:190:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:194:  Undefined symbol "L" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:195:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:197:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:201:  Undefined symbol "L" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:202:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:204:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:208:  Undefined symbol "L" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:209:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:211:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:214:  Undefined symbol "L" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:215:  Undefined symbol "G" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:217:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:221:  Undefined symbol "L" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:221:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:230:  Undefined symbol "InvC" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:232:  Undefined symbol "C" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:238:  Undefined symbol "InvC" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:240:  Undefined symbol "C" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:246:  Undefined symbol "InvC" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:248:  Undefined symbol "C" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:254:  Undefined symbol "InvC" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:256:  Undefined symbol "C" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:262:  Undefined symbol "InvC" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:264:  Undefined symbol "C" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:279:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:284:  Undefined symbol "SelectedColor" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:292:  Undefined symbol "C" detected.
    BUILD: ERROR: C:\temp\eclipse-workspace\Digital Elegant4\source\DigitalElegantView.mc:298:  Undefined symbol "B" detected.

    Here are the main parts of the code that we discussed about, I really can't understand what have I done wrong with it.

    class DigitalElegantView extends WatchUi.WatchFace {
    
        var Battery;
        var InvBattery;
        var AOD;
        var BGC;
        var BTstatusBitmap;
        var inLowPower = false;
        var canBurnIn = false;
    
        class Settings {
            function initialize() {
                WatchFace.initialize();
                load();
                var MySettings = new Settings();
                if (System.getDeviceSettings() has: requiresBurnInProtection) {
                    canBurnIn = System.getDeviceSettings().requiresBurnInProtection;
                }
                Battery = WatchUi.loadResource(Rez.Drawables.Battery);
                InvBattery = WatchUi.loadResource(Rez.Drawables.InvBattery);
    
            }
    function load() {
                var B = Application.Properties.getValue("BG");
                if (B == 0) { BGC = Graphics.COLOR_BLACK; }
                if (B == 1) { BGC = Graphics.COLOR_WHITE; }
                var SelectedColor;
                SelectedColor = Application.Properties.getValue("TextColor");
                var R = Application.Properties.getValue("RightIndicator");
                var L = Application.Properties.getValue("LeftIndicator");
                var C = null;
                var InvC = null;
                var G = null;
    
                if (B == 0) {
                    C = Graphics.COLOR_WHITE;
                    InvC = Graphics.COLOR_BLACK;
                    G = Graphics.COLOR_LT_GRAY;
                }
                if (B == 1) {
                    C = Graphics.COLOR_BLACK;
                    InvC = Graphics.COLOR_WHITE;
                    G = Graphics.COLOR_DK_GRAY;
                }
    
                if (B == 0) {
                    dc.drawBitmap(dc.getWidth() * 0.2404, dc.getHeight() * 0.1202, WatchUi.loadResource(Rez.Drawables.NotificationIcon));
                    dc.drawBitmap(dc.getWidth() * 0.452, dc.getHeight() * 0.1226, Battery);
                }
                if (B == 1) {
                    dc.drawBitmap(dc.getWidth() * 0.2404, dc.getHeight() * 0.1202, WatchUi.loadResource(Rez.Drawables.InvNotificationIcon));
                    dc.drawBitmap(dc.getWidth() * 0.452, dc.getHeight() * 0.1226, InvBattery);
                }
            }
    
            function onSettingsChanged() {
                view.MySettings.load();
                WatchUi.requestUpdate();
            }
    
            // Update the view
            function onUpdate(dc as Dc) as Void {

    I am adding the full view.mc code here because I believe it will be useful: https://pastebin.com/qLwewjhJ

  • There are things you want in your view class and not the settings class, and things like onSettingChanged belong in your base class and not the view or the settings class.

  • What does base class mean? I have only the view class and the settings class in my view.mc file. Also, between where am I supposed to put the onSettingsChanged function here?

  • Your AppBase class.

    class MyApp extends Application.AppBase {
    	var view;
    
        function initialize() {
            AppBase.initialize();
        }
        
        function onSettingsChanged() {
        	view.MySettings.load();
        	Ui.requestUpdate();
        }
        
        //and a whole bunch more
    }

    I think you may need to spend some time with the samples in the SDK as well as the doc to learn program structure, classes, etc.