Module: Toybox::PersistedContent

Overview

Note:

As a general rule, Fitness and Edge devices will support .FIT format. Outdoor devices will support .GPX format.

The PersistedContent module allows access to stored routes, waypoints, and other stored user data.

This module provides an Iterator class that gives access to content stored on the device. Included content types are as follows:

Each of these objects can utilize System.Intents to to launch the appropriate application type for the content type (e.g. The workout might launch the workout player). This is typically used in conjunction with the Communications module to retrieve content of type .FIT and .GPX and later access it using the get methods provided within this module.

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;
using Toybox.System;

var iterator = PersistedContent.getCourses; // Get the Iterator
var content = iterator.next();              // Get the next object in the iterator

var name = content.getName();               // Get the content name
var id = content.getId();                   // Get the content id
System.ExitTo(content.toIntent());          // Use the content for a System.Intent

See Also:

Since:

  • 2.2.0

App Types:

  • Widget

  • App

Requires Permission:

  • PersistedContent

Defined Under Namespace

Classes: Course, Iterator, Route, Track, Waypoint, Workout

Instance Method Summary collapse

Instance Method Details

getAppCoursesToybox::PersistedContent::Iterator

Get the subset of courses installed on the system that are owned by the application

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

// Get an iterator for all courses owned by this application
var iterator = PersistedContent.getAppCourses();

Returns:

Since:

  • 3.0.0



7388
7389
# File 'Monkeybrains.rb', line 7388

def getAppCourses()
end

getAppRoutesToybox::PersistedContent::Iterator

Get the subset of routes installed on the system that are owned by the application

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

// Get an iterator for all routes owned by this application
var iterator = PersistedContent.getAppRoutes();

Returns:

Since:

  • 3.0.0



7402
7403
# File 'Monkeybrains.rb', line 7402

def getAppRoutes()
end

getAppTracksToybox::PersistedContent::Iterator

Get the subset of tracks installed on the system that are owned by the application

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

// Get an iterator for all tracks owned by this application
var iterator = PersistedContent.getAppTracks();

Returns:

Since:

  • 3.0.0



7416
7417
# File 'Monkeybrains.rb', line 7416

def getAppTracks()
end

getAppWaypointsToybox::PersistedContent::Iterator

Get the subset of waypoints installed on the system that are owned by the application

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

// Get an iterator for all waypoints owned by this application
var iterator = PersistedContent.getAppWaypoints();

Returns:

Since:

  • 3.0.0

Supported Devices:

  • All devices execept Approach S60 / vivoactive / vivoactive HR / Edge 130



7430
7431
# File 'Monkeybrains.rb', line 7430

def getAppWaypoints()
end

getAppWorkoutsToybox::PersistedContent::Iterator

Get the subset of workouts installed on the system that are owned by the application

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

// Get an iterator for all workouts owned by this application
var iterator = PersistedContent.getAppWorkouts();

Returns:

Since:

  • 3.0.0



7443
7444
# File 'Monkeybrains.rb', line 7443

def getAppWorkouts()
end

getCoursesToybox::PersistedContent::Iterator

Get the courses installed on the system

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

var iterator = PersistedContent.getCourses(); // Get the Iterator

Returns:

Since:

  • 2.2.0



7455
7456
# File 'Monkeybrains.rb', line 7455

def getCourses()
end

getRoutesToybox::PersistedContent::Iterator

Get the routes installed on the system

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

var iterator = PersistedContent.getRoutes(); // Get the Iterator

Returns:

Since:

  • 2.2.0



7466
7467
# File 'Monkeybrains.rb', line 7466

def getRoutes()
end

getTracksToybox::PersistedContent::Iterator

Get the tracks installed on the system

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

var iterator = PersistedContent.getTracks(); // Get the Iterator

Returns:

Since:

  • 2.2.0



7478
7479
# File 'Monkeybrains.rb', line 7478

def getTracks()
end

getWaypointsToybox::PersistedContent::Iterator

Get the waypoints installed on the system

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

var iterator = PersistedContent.getWaypoints(); // Get the Iterator

Returns:

Since:

  • 2.2.0

Supported Devices:

  • All devices execept Approach S60 / vivoactive / vivoactive HR / Edge 130



7491
7492
# File 'Monkeybrains.rb', line 7491

def getWaypoints()
end

getWorkoutsToybox::PersistedContent::Iterator

Get the workouts installed on the system

Examples:

// Assumes content already saved on device
using Toybox.PersistedContent;

var iterator = PersistedContent.getWorkouts(); // Get the Iterator

Returns:

Since:

  • 2.2.0



7502
7503
# File 'Monkeybrains.rb', line 7502

def getWorkouts()
end

saveWaypoint(location, options) ⇒ Object

Save a Location as a Waypoint to the device's location list

Examples:

using Toybox.PersistedContent;
using Toybox.Position;

var location = new Position.Location(
       {
       :latitude => <latitude_coordinates>,
       :longitude => <longitude_coordinates>,
       :format => :degrees
       }
);
PersistedContent.saveWaypoint(location, {:name => "Cool Waypoint Name"});

Parameters:

Options Hash (options):

  • :name (Toybox::Lang::String)

    The name to assign to the waypoint. If not specified the waypoint will be named automatically.

See Also:

Since:

  • 2.2.0

Supported Devices:

  • All devices execept Approach S60 / vivoactive / vivoactive HR / Edge 130



7529
7530
# File 'Monkeybrains.rb', line 7529

def saveWaypoint(location, options)
end