Module: Toybox.Application.DynamicResource

Overview

The Dynamic Resource module provides APIs for loading resources from dynamic sources.

Since:

API Level 6.0.3

Supported Devices:

Constant Summary

Status

Represents the result status of an asynchronous build operation, such as one used for persisted content.

Since:

API Level 6.0.3

Name Value Since Description
STATUS_SUCCESS 0

API Level 6.0.3

STATUS_ERROR 1

API Level 6.0.3

Type

The type of dynamic resource being loaded.

Since:

API Level 6.0.3

Name Value Since Description
TYPE_IMAGE 0

API Level 6.0.3

Image dynamic resource type, expected resource type after loading is [Toybox::Graphics::BitmapResource].

TYPE_PERSISTED_CONTENT 2

API Level 6.0.3

Persisted content resource, e.g. FIT, GPX files, expected return type after 'build' is a [Toybox::Application::DynamicResource::PersistedContentCallback] to receive the content asynchronously after the content is persisted on the device.

TYPE_AUDIO 3

API Level 6.0.3

Audio dynamic resource type, expected resource type after loading is [Toybox::Audio::DynamicAudioSource]. format is mandatory for this type and should be specified with Audio.ContainerFormat values.

ImageFormat

Image formats that can be specified when loading image dynamic resources.

Since:

API Level 6.0.3

Name Value Since Description
IMAGE_FORMAT_PNG 0

API Level 6.0.3

IMAGE_FORMAT_JPEG 1

API Level 6.0.3

IMAGE_FORMAT_GIF 2

API Level 6.0.3

First frame of GIF will loaded as BitmapResource.

Typedef Summary collapse

Instance Method Summary collapse

Typedef Details

Options as { :type as DynamicResource.Type, :format as Audio.ContainerFormat or DynamicResource.ImageFormat or Null, :data as Lang.ByteArray, :callback as DynamicResource.PersistedContentCallback or Null }

Dynamic Resource Options

Since:

API Level 6.0.3

PersistedContentCallback as Lang.Method(content as { :status as DynamicResource.Status, :iterator as PersistedContent.Iterator or Null, :count as Lang.Number or Null }) as Void

Persisted content callback to receive the result of a persisted content build operation.

Since:

API Level 6.0.3

Supported Devices:

Instance Method Details

build(options as DynamicResource.Options) as WatchUi.BitmapResource or Output.DynamicAudioSource or Null

Load a dynamic resource.

Parameters:

Returns:

  • WatchUi.BitmapResource, DynamicAudioSource, Null —

    The loaded resource, or null if loading fails. For persisted content, the result is returned via the callback in options.

Since:

API Level 6.0.3

Throws:


Generated Oct 19, 2026, 4:16:38 PM