Way to restart watchface after update?

Recently every time I update one of my watchfaces, I get a lot of reports of weird errors. It seems like the old version of the face keeps running (confirmed when looking at version number on the face itself), while having the new config (properties/settings/resource) loaded (my guess). This is causing issue like broken fonts and crashes. A restart fixes everything usually.

As a simple solution it would be great to be able to restart the watchface after it receives an update.

I am using the "onAppUpdate" method in the appbase to send a message to the foreground, but then what? 
System.exit() doesnt work on watchfaces

System.exitTo(intent) also doesn't work on watchfaces

Complications.exitTo opens the complication, but doesn't exit the watchface

I could make it crash when it received that message, but that doesn't seem like a great solution either.

A simple reinitialization of the whole watchface would be great, and I would expect this after an update, but it doesn't happen automatically.

Is there a way to achieve this?

  • It seems like the old version of the face keeps running (confirmed when looking at version number on the face itself), while having the new config (properties/settings/resource) loaded (my guess). This is causing issue like broken fonts and crashes. A restart fixes everything usually.

    This seems like a bug in CIQ or the firmware which should be reported. (Personally I would file a CIQ bug report - if the bug is indeed in the firmware, imo the CIQ team is better equipped to ask the device team to fix it as opposed to the end user.)

    I could make it crash when it received that message, but that doesn't seem like a great solution either.

    Yeah, you could probably make it crash by calling popView() or System.exit().

    If you don't want to crash your app, it seems that the only alternative would be to display a message to the end user asking them to restart the watchface. Ofc this is tricky, because is it enough for the user to scroll away from the watchface and scroll back? If that's enough in all cases, maybe it would be ok.

    Or would they have to do something more involved, like start an activity, or select a different watchface (then change it back)?

    You could also ask the user to power cycle the watch - that would be the simplest catch-all solution (that doesn't involve crashing the app), but it might be unacceptable for some users.

  • Thank you! Showing a message asking to restart (if they have issues) is a good idea. That way user with issues know how to fix it, and I'll remove the message with countdown after like 30 seconds. That's a good enough fox for now, until the underlying issue is fixed.

    Is agree this should be a bug report. 

  • One thing to consider on a device with the graphics pool (ciq>=4.0), is that an update can be installed, but if you changed things like fonts and bitmaps, it could still be using the old ones from the graphics pool.  I've not seem this more than a couple times, but I rarely change fonts or bitmaps.  I had to turn the watch off and on to clear the graphics pool.

  • Yes, it seems this was the issue. I updated an icon font, likely it got assigned to the same pool as my main font, since the main font was replaced with the icon font. Only a reboot helped, switching faces didn't. Here what it looked like for one of the users: 

  • Remember, there is only one graphics pool on the device, and it's shared between all apps and the size is limited. 

    What you can try is using a different ID if you change a font or bitmap, so the new one gets loaded, but then you might have both the old and new one in the graphics pool until a power cycle, using more space.

    Oh, one more note!  Remember that onAppUpdate/onAppInstalled wont be called unless your app has the background permission, and then they call called in the background.

  • Yes, I learned the hard way resources have to be unloaded. I was using two full color, full screen layers/buffered bitmaps at some point, and other apps started to glitch.

    When the face is updated, it keeps running so nothing gets unloaded. 

    My solution: on onAppUpdated BG sends a message to the foreground and the foreground clears all resources, resets all loaded classes and reinitializes them. Not perfect (I'd love to fully reinit the view class as well) but this should (in theory) catch most issues. I'm using background on all my faces already for OWM integration and calculating monthly/weekly stats, so that's not an issue.

    Thank you so much for the insights!