Android APIs
public static class

Fitness.Intents

extends Object
java.lang.Object
   ↳ com.google.android.gms.fitness.Fitness.Intents

Class Overview

Useful constants and methods for dealing with intents in the Fitness platform.

Summary

Constants
String EXTRA_DATA_SOURCE Name for the parcelable intent extra containing the data source/
String EXTRA_END_TIME Name for the long intent extra containing the end time.
String EXTRA_SESSION Name for the parcelable intent extra containing the data session/
String EXTRA_START_TIME Name for the long intent extra containing the start time.
String MIME_ACTIVITY_TYPE_PREFIX The common prefix for Activity types.
String MIME_DATA_TYPE_PREFIX The common prefix for Fitness data type mime types.
Public Methods
static String getActivityMimeType(int activity)
Returns the mime type for a particular activity.
static DataSource getDataSource(Intent intent)
Retrieves the data source extra from the given intent.
static String getDataTypeMimeType(DataType dataType)
Returns the mime type for a particular DataType.
static long getEndTime(Intent intent)
Retrieves the end time extra from the given intent.
static long getStartTime(Intent intent)
Retrieves the start time extra from the given intent.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String EXTRA_DATA_SOURCE

Name for the parcelable intent extra containing the data source/

Constant Value: "com.google.android.gms.fitness.data_source"

public static final String EXTRA_END_TIME

Name for the long intent extra containing the end time.

Constant Value: "com.google.android.gms.fitness.end_time"

public static final String EXTRA_SESSION

Name for the parcelable intent extra containing the data session/

Constant Value: "com.google.android.gms.fitness.session"

public static final String EXTRA_START_TIME

Name for the long intent extra containing the start time.

Constant Value: "com.google.android.gms.fitness.start_time"

public static final String MIME_ACTIVITY_TYPE_PREFIX

The common prefix for Activity types. The mime type for a particular activity type will be this prefix followed by the activity name.

Constant Value: "vnd.google.android.fitness.activity_type/"

public static final String MIME_DATA_TYPE_PREFIX

The common prefix for Fitness data type mime types. The mime type for a particular data type will be this prefix followed by the data type name.

Constant Value: "vnd.google.android.fitness.data_type/"

Public Methods

public static String getActivityMimeType (int activity)

Returns the mime type for a particular activity.

Parameters
activity one of the activities in FitnessActivities.

public static DataSource getDataSource (Intent intent)

Retrieves the data source extra from the given intent.

Returns
  • the data source, or null if not found

public static String getDataTypeMimeType (DataType dataType)

Returns the mime type for a particular DataType.

public static long getEndTime (Intent intent)

Retrieves the end time extra from the given intent.

Returns
  • the end time, in milliseconds since epoch, or -1 if not found

public static long getStartTime (Intent intent)

Retrieves the start time extra from the given intent.

Returns
  • the start time, in milliseconds since epoch, or -1 if not found