This interface is deprecated.
For reading and writing historical fitness data, use Health Connect
instead.
API for accessing custom data types and settings in Google Fit.
Custom data type
definitions can be added and then retrieved using
createCustomDataType(GoogleApiClient, DataTypeCreateRequest)
and
readDataType(GoogleApiClient, String)
.
disableFit(GoogleApiClient)
can be used to disconnect your app from Google
Fit.
The Config API should be accessed via the Fitness
entry
point. Example:
GoogleApiClient client = new GoogleApiClient.Builder(context) .addApi(Fitness.CONFIG_API) ... .build(); client.connect(); PendingResult<DataTypeResult> pendingResult = Fitness.ConfigApi.readDataType( client, "com.example.my_custom_data_type"); DataTypeResult dataTypeResult = pendingResult.await(); DataType dataType = dataTypeResult.getDataType();
Public Method Summary
abstract PendingResult<DataTypeResult> |
createCustomDataType(GoogleApiClient
client,
DataTypeCreateRequest request)
This method is deprecated. Support for custom data types will be removed in
a future version of Google Fit. Use one of the pre-defined data types listed in
DataType .
|
abstract PendingResult<Status> | |
abstract PendingResult<DataTypeResult> |
readDataType(GoogleApiClient
client, String
dataTypeName)
This method is deprecated. Support for custom data types will be removed in
a future version of Google Fit. Use one of the pre-defined data types listed in
DataType .
|
Public Methods
public abstract PendingResult<DataTypeResult> createCustomDataType (GoogleApiClient client, DataTypeCreateRequest request)
This method is deprecated.
Support for custom data types will be removed in a future version of Google Fit. Use one
of the pre-defined data types listed in DataType
.
Defines a new data type which is added to the Google Fit platform on behalf of the current application. Useful for adding a private custom data type for recording app-specific data. Custom data created by one app will not be visible to other apps.
Example:
PendingResult<DataTypeResult> pendingResult = ConfigApi.createCustomDataType( client, new DataTypeCreateRequest.Builder() .setName(DATA_TYPE_NAME) .addField(MY_FIELD1) .addField(MY_FIELD2) .build()); DataTypeResult result = pendingResult.await();
Parameters
client | An existing GoogleApiClient. Must be connected at the time of this call. |
---|---|
request | The new data type name and fields that need to be added. |
Returns
- A pending result containing the status of the request. If an existing data type
has the same name but different fields, the operation will fail with
FitnessStatusCodes.CONFLICTING_DATA_TYPE
. If application package name does not matchDataType
's name, the operation will fail withFitnessStatusCodes.INCONSISTENT_DATA_TYPE
status code.
public abstract PendingResult<Status> disableFit (GoogleApiClient client)
Disables Google Fit for an app. Can be used to revoke all granted OAuth access permissions from an app and consequently remove all existing subscriptions and registrations of the app.
Parameters
client | An existing GoogleApiClient. Must be connected at the time of this call. |
---|
Returns
- Result containing the status of the request.
public abstract PendingResult<DataTypeResult> readDataType (GoogleApiClient client, String dataTypeName)
This method is deprecated.
Support for custom data types will be removed in a future version of Google Fit. Use one
of the pre-defined data types listed in DataType
.
Returns a data type with the specified dataTypeName
. Useful to retrieve
shareable data types added by other apps or custom data types added by your app. Custom
data types created by other apps will not be returned.
Parameters
client | An existing GoogleApiClient. It does not need to be connected at the time of this call, but the read result will be delayed until the connection is complete. |
---|---|
dataTypeName | Name of the data type we want to read. |
Returns
- Result containing the status of the request.