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

  • Audio Content Provider 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


7813
7814
# File 'Monkeybrains.rb', line 7813

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


7827
7828
# File 'Monkeybrains.rb', line 7827

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


7841
7842
# File 'Monkeybrains.rb', line 7841

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


7855
7856
# File 'Monkeybrains.rb', line 7855

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


7868
7869
# File 'Monkeybrains.rb', line 7868

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


7880
7881
# File 'Monkeybrains.rb', line 7880

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


7891
7892
# File 'Monkeybrains.rb', line 7891

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


7903
7904
# File 'Monkeybrains.rb', line 7903

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


7916
7917
# File 'Monkeybrains.rb', line 7916

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


7927
7928
# File 'Monkeybrains.rb', line 7927

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


7954
7955
# File 'Monkeybrains.rb', line 7954

def saveWaypoint(location, options)
end