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

  • Background Services

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


8963
8964
# File 'Monkeybrains.rb', line 8963

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


8977
8978
# File 'Monkeybrains.rb', line 8977

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


8991
8992
# File 'Monkeybrains.rb', line 8991

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


9005
9006
# File 'Monkeybrains.rb', line 9005

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


9018
9019
# File 'Monkeybrains.rb', line 9018

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


9030
9031
# File 'Monkeybrains.rb', line 9030

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


9041
9042
# File 'Monkeybrains.rb', line 9041

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


9053
9054
# File 'Monkeybrains.rb', line 9053

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


9066
9067
# File 'Monkeybrains.rb', line 9066

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


9077
9078
# File 'Monkeybrains.rb', line 9077

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


9104
9105
# File 'Monkeybrains.rb', line 9104

def saveWaypoint(location, options)
end