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


8966
8967
# File 'Monkeybrains.rb', line 8966

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


8980
8981
# File 'Monkeybrains.rb', line 8980

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


8994
8995
# File 'Monkeybrains.rb', line 8994

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


9008
9009
# File 'Monkeybrains.rb', line 9008

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


9021
9022
# File 'Monkeybrains.rb', line 9021

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


9033
9034
# File 'Monkeybrains.rb', line 9033

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


9044
9045
# File 'Monkeybrains.rb', line 9044

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


9056
9057
# File 'Monkeybrains.rb', line 9056

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


9069
9070
# File 'Monkeybrains.rb', line 9069

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


9080
9081
# File 'Monkeybrains.rb', line 9080

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


9107
9108
# File 'Monkeybrains.rb', line 9107

def saveWaypoint(location, options)
end