DF App works only one time when deployed on my Fenix

Hi everyone,

I thought i had finished my DF app, because everthing was working well on the simulator thus i submitted my app on Garmin Connect (as a Beta version). But when i start the app Running on my watch and add my DF i only see it one time. If i go back to the menu of activities or to my watchface, and launch again the app Running, there is a white screen with the IQ logo and an exclamation point rather than my DF.

I don't know where to look to find the problem, because it works on Eclipse simulator.

I thought maybe it was a problem with the onStart() function but i changed nothing in the file xxxApp.mc. (By the way i didn't quite understood the goal of this file because the functions written in it are empty for the most of them. And i know that this remark is probably totally stupide ^^).

PS: i have some settings for my DF which i call at the beginning of the xxxView.mc file using this code :

	var distance = Application.getApp().getProperty("distance");
	var duree = Application.getApp().getProperty("duree");
	var bool = Application.getApp().getProperty("StrategieAllure");
    var k = Application.getApp().getProperty("CoeffStrat")/100.0;

just where i declare my variables.

  • Check the garmin/apps/logs/ciq_log.* file on your watch..

    There's a lot that can go on in your appBase class.  getInitialView is where your view gets created and started, but there's also things like onSettingsChanged(), getServiceDelegate, etc.

    BTW, you may find it easier to find this with a sideload built with debug symbols ("build for device wizard" in eclipse).  The ciq_log file will be easier to understand.

  • Thank you, thanks to the ciq_log file i found out that it was a problem concerning the displaying of the current time. I don't know why it doesn't work, but that not a really important feature anyway.

  • Not sure if this is relevant in your case, but I have seen something similar when I am reading from the properties file ( Application.getApp().getProperty("X");).

    In my case, I had a property that was not included in the settings file for users. What happened was that the property was set when the data field was installed, but wiped to "null" when users saved new settings. 

    So...

    I got around it by testing that the property was not null and using a default if it was.

    G

  • If there's no setting, you probably want to use Storage instead of Properties.

    if you use setProperty()/getProperty(), don't have the property in the xml.

  • AH! That would be better, yes! I hadn't thought about it and it was a temporary hiding as I was considering a new feature which I hadn't put live yet, but I do have a few places where app specific constants like that might make sense.

    Is there a way to prepopulate storage from XML, though?

    EG: Rather than have to hardcode "Storage.setProperty()" can I compile an XML which has "<storage id="">value</storage>" or similar?

  • not compiling an xml, but an easy way to do it is to have things in a class to but provide a default and keep the valse.

    In the new developer FAW wiki, you'll see a function called readKeyInt().  It does an extra check for the type of value, but does the read based on a key

    so lets say you have a function called load() that loads what you use from storage in initalize()

    var sValue1=3;         //set default value for sValue1

    var sValue2=17;      //set default value for sValue2

    ...

    function load() {

      app=Application.getApp();

      sValue1=readKeyInt(app,"mykey1",sValue1);

      sValue2=readKeyInt(app,"mykey2",sValue2);

    ....  

    }

    you can set a default, and if the key doesn't exist, use the default.  All your defaults are in a single spot, and you don't have a bunch of inline null checks.  In your code you then just reference sValue1, sValue2, etc, and only save them back if they change