java.lang.Object | |
↳ | com.google.android.gms.fitness.ViewDataIntentBuilder |
Builder of intents to view data stored in Google Fit, for a particular
data source
.
This intent can be used when the application wants to display a more detailed view of a
particular data type
.
Apps that can handle that data type (such as the app that inserted the data) can register for the
intent.
setPreferredApplication(String)
can be called to set a specific application
to handle the intent, if the application is installed on the device.
This will often be the application defined in
getAppPackageName()
.
The data view intent has the following attributes:
ACTION_VIEW
MIME_TYPE_DATA_TYPE_PREFIX
followed by the data type
name. For example vnd.google.fitness.data_type/com.google.step_count.cumulative
.
FitnessIntents
.
<activity android:name="com.example.ViewHeartRateActivity" android:exported="true"> <intent-filter> <action android:name="vnd.google.fitness.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.google.fitness.data_type/com.google.heart_rate.bpm" /> </intent-filter> </activity>
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the built intent, which can be used with
startActivity(Intent) to
launch the desired Fitness activity. | |||||||||||
Sets the data source to display data for, if a specific data source is desired.
| |||||||||||
Sets a preferred application to use for this intent.
| |||||||||||
Sets the time interval to display data for.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Returns the built intent, which can be used with startActivity(Intent)
to
launch the desired Fitness activity.
IllegalStateException | if not enough data has been passed into the Builder to build a valid intent. |
---|
Sets the data source to display data for, if a specific data source is desired. Otherwise, the viewer can choose any data source or use the default one.
dataSource | the specific data source we want to display data for |
---|
Sets a preferred application to use for this intent. If the given app is installed and
able to handle this intent, an explicit intent will be returned. This can be used in
combination with getAppPackageName()
to link back to the original
application which inserted the data being displayed.
packageName | the package name for the application we want to link to |
---|
Sets the time interval to display data for. Every intent requires a valid time interval.
startTimeMillis | start time, inclusive, in milliseconds since epoch |
---|---|
endTimeMillis | end time, exclusive, in milliseconds since epoch |