Watch face doesn't load on the watch but works well in the simulator

Former Member
Former Member
Hay guys !

I'm developping a watch face for the Fenix 3 and I don't know why it loads on the simulator but not on the actual watch.

I tried to figure out what's going on but I can't find some sort of clue...

It uses the last firmware, the last SDK and it uses settings too... Maybe is there a problem with these?

Here's my resources.xml code :

http://pastebin.com/2Gji5SZP

My watch face uses 27KB over 65 on the simulator... could it be a performance issue?

Thanks for your help!
  • First, if you use properties configuration, you should check loaded values for null, empty string and data type.

    You can add println to your methods and write some attribute and property values into log file. To enable logging on your device, create <app_name>.txt file in /GARMIN/APPS/LOGS (app_name is PRG file name without .prg extension). Then, your watchface will write all println outputs into this file and you can check what happens inside.
  • Former Member
    Former Member over 9 years ago
    I didn't know that I can create a log file like this. Thank you for this tips.

    By the way, i'm pretty sure I can't have null data since I check them as you said...

    BUT : When I look at the exception in the log file, I get this :

    UnexpectedTypeException: Expected Number/Boolean/Long, given null
    initialize in D:\Projects\outdoor\Fenix3_Build\TVM\api\Ant.mb:124

    I don't understand the point of this error... I understand the first line but... What does mean the second one ? Why this file ?

    I checked if I enabled ANT on the manifest but no... I don't understand...
  • The error message is little confusing and contains a path from Garmin's local compilator. It doesn't mean that it relates to Ant.

    The message is just nullpointer or unexpected null operand in an expression (i.e. xxx = null; if (xxx > 0)... xxx cannot be null).
  • Former Member
    Former Member over 9 years ago
    EDIT : Nevermind! You were absolutely right!

    Actually, I added some code few days ago and I forgot to check for null values... I finally got it!

    The strange part is that my code works on the simulator... Maybe it defines null value to 0 ?
  • You can try to post here a code snippet or example how to recreate it + information on which device you test and I can check it and report to Garmin, if you want.
  • Former Member
    Former Member over 9 years ago
    Sure!

    Actually, there is nothing more than a variable at the top of the code which defines whether or not low power is on or off and a if statement at the end of onUpdate().
    Here's an example:

    class myFaceView extends Ui.WatchFace{

    var highPower;

    function onUpdate(dc){
    //Check for low power state
    if(highPower){
    //Some code here
    }
    }

    function onExitSleep(){
    highPower= true;
    Ui.requestUpdate();
    }

    function onEnterSleep(){
    highPower = false;
    Ui.requestUpdate();
    }
    }


    My mistake was just I forgot to initialize the variable at the begining by setting it to false. The problem was that the simulator didn't care about this error and carried on :p

    Obviously, the right way to do this is to initialize the variable to false (which I forgot to do):

    class myFaceView extends Ui.WatchFace{

    var highPower = false;

    function onUpdate(dc){
    //Check for low power state
    if(highPower){
    //Some code here
    }
    }

    function onExitSleep(){
    highPower= true;
    Ui.requestUpdate();
    }

    function onEnterSleep(){
    highPower = false;
    Ui.requestUpdate();
    }
    }