journey.files

Version compatibility

journey.files was introduced with version 4.80.0 of the JourneyApps Runtime.

Ability to interact with files in JourneyApps.

Property
Description
Example

saveFile

Saves a file to the device.

Note: Due to limitations on mobile file systems, this method is only supported on Desktop and Web.

viewFile

Opens a file viewer in-app to display an attachment.

Note: Supported file types: .jpg/.jpeg, .png, and pdf.

openFileExternally

Opens the default file viewer (based on media type) of the device to display an attachment. Supported file types for RealWear: .jpg/.jpeg, .png, .bmp, .webp, .gif, .pdf.

Note:

  • Supported in JourneyApps Container version 22.2.1 and Runtime version 4.84.0 and later.

  • This method is currently not supported on Web.

Examples

journey.files.saveFile

journey.files.viewFile(data, filename) where data is the string or ArrayBuffer to save to the file, and filename is a string containing the name of the file created.

Saving a string:

function saveText() {
    var text = "Text to save!";
    journey.files.saveFile(text, 'my-file.txt');
}

Saving a photo:

<var name="site_entrance" type="photo" />

<capture-photo label="Site entrance" bind="site_entrance" source="camera" resolution="small" downloadable="true" />
<button show-if="site_entrance" label="Save photo" on-press="$:savePhoto()" validate="false" />

journey.files.viewFile

journey.files.openFileExternally

TypeScript apps

Synced state

Ensure that the attachment is synced, by calling journey.synchronize() before either journey.files.viewFile or journey.files.openFileExternally.

Last updated