Optimize memory usage for Watch Face Format

As described in the Wear OS app quality guidelines, watch faces that use the Watch Face Format have limits on the amount of memory that they can consume, depending on the watch's current state:

  • In ambient mode, the watch face can't consume more than 10 MB of memory.
  • In interactive mode, the watch face can't consume more than 100 MB of memory.

By following the suggestions in this guide, you're more likely to create a watch face whose memory consumption stays within these limits.

Crop and resize bitmap fonts

Crop your images and BitmapFont objects, and resize them to match their display size.

When Wear OS draws a watch face, all images are decompressed. A full-screen image that's mostly blank might consume 3 KB on disk, but if it's displayed on a 450-pixel x 450-pixel screen, the system decompresses the image, increasing the image's size in memory to 750 KB or larger.

Use consistent bitmap font heights

When using a BitmapFont, all images for a character should each have the same height. Likewise, all images for words should each have the same height.

Deduplicate images

If your watch face displays multiple copies of the same image, load only one copy of that image into memory and make several references to that one image.

Show progress using arcs

To emulate a progress bar that completes after 1 minute or after 1 hour, don't use 60 separate images. Instead, create an Arc object that contains an expression controlling its length, as shown in the following code snippet:

<PartDraw angle="0" width="400" height="400" name="ProgressBar"
          pivotX="0.5" pivotY="0.5 x="40" y="40">
    <Arc centerX="200" centerY="200" width="400" height="400"
         startAngle="0" endAngle="360">
        <!-- Completes a "progress loop" every minute. -->
        <Transform target="endAngle"
                   value="0 + (clamp([SECOND], 0, 60) - 0) * 6" />
        <Stroke cap="ROUND" color="#123456" thickness="10" />

To display a non-continuous line, for example to achieve a retro digital watch style look, use either a dash property for a Stroke object or a semi-transparent mask image overlay.

Evaluate the performance of your watch face

To measure the memory performance of your watch face, use the memory footprint evaluator tool, available in the watchface repository on GitHub.