Settings change not showing on watch face until after reload

I am displaying if you have an alarm set or any notifications in a clock face.  The display only updates after the clock face is left and then returned to.  For example, If I change the Notification count in ConnectIQ Device Simulator from 0 to 4, the Notification will not show up until after I select the reload. 

in my View.mc file, in the class level, I have:
     function onUpdate(dc) as Void {
         dc.clear();
         // calls for other functions like DrawNotifications();
    }

 

Further down the View.mc I have added:

    function onSettingsChanged() {
        View.onUpdate(dc);
    }
I have in my App.mc file, at the class level:
    function onSettingsChanged() {
        WatchUi.requestUpdate();
        View.onUpdate(dc);
    }
If it helps, here is my Notifications function:
    //Display notification information
    function drawNote(){

        //See if there are any system notices
        var noteLoad = mySettings.notificationCount;
        var noteString="N";
        var noteStr = Lang.format("$1$", [noteString]);
        var noteDisplay = View.findDrawableById("noteLabel") as Text;
        if (noteLoad !=0) {
            noteDisplay.setText(noteString);
        }
    }
I have an image as a background, but tried dc.setColor(Graphics.COLOR_BLACK,Graphics.COLOR_BLACK); before the dc.clear() with no luck. 
If I change any of my settings in the "Edit Applications.Properties data", they change properly.
What am I missing?
The Code on Git: github.com/.../AviationTime
  • In your AppBase, onSettingsChanged needs to trigger the load of your Application.Properties.

    I don't see where you are calling Application.Properties.getValue() at all.  You want to do it when your app starts or onSettingsChanged().

  • Thanks for the reply.

    I've been trying to incorporate your feedback with no success.  The onSettingsChanged does NOT get triggered when the notifications count nor the alarm count are changed, only a settings change (like font color).  

    I've started a watch face that only does time and tells me how many notifications I have and no other options (keeping it simple).  This should alleviate the need for me from ever needing to call System.getDeviceSettings(). 

    in APP.mc, I've included:

    function onSettingsChanged() {
        WatchUi.requestUpdate();
        NotificationsView.onUpdate(dc);
        System.println("App changed");
    }

    The DEBUG CONSOLE never shows the notification count as changing while the watch face is running. I have a similar set up in the VIEW.mc .  

    Also, I don't know if it matters, by I am only doing this for a min app level of 4.0.0

    Thanks again for any help.

  • onSettingsChanged is ONLY called when you change app settings.

    Not for things like alarm or notification counts change.  You just want to get those values when onUpdate() is called.  Same with things like step count, calories, move bar level, etc,  To change things in the sim like notifcation count, youy change that in the sim  Settings>Alarm Count for example 

  • Yes. I got all of that.  So...Here's the solution.

    The alarmCount and notificationCount only adjusted if I used the full code and not the abbreviated. 

    So, I replaced:

    mySettings = System.getDeviceSettings();

    ...

    noteCount = mySettings.NotificationCount;

    with only:

    noteCount = System.getDeviceSettings().NotificationCount;

    Yep.  Now it works.  Dunno why.