java.lang.Object | ||
↳ | com.google.android.gms.common.api.GoogleApi<com.google.android.gms.fitness.FitnessOptions> | |
↳ | com.google.android.gms.fitness.ConfigClient |
Client for accessing custom data types and settings in Google Fit.
Custom data type
definitions can be added and then retrieved using createCustomDataType(DataTypeCreateRequest)
and readDataType(String)
.
disableFit()
can be used to disconnect your app from Google Fit.
The Config Client should be accessed via the Fitness
entry point. Example:
GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .build(); Task<GoogleSignInAccount> task = GoogleSignIn.getClient(this, signInOptions) .silentSignIn(); GoogleSignInAccount googleSigninAccount = Tasks.await(task); Task<DataType> response = Fitness.getConfigClient(this, googleSigninAccount) .readDataType("com.example.my_custom_data_type"); DataType dataType = Tasks.await(response);
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Defines a new data type which is added to the Google Fit platform on behalf of the current
application.
| |||||||||||
Disables Google Fit for an app.
| |||||||||||
Returns a data type with the specified
dataTypeName . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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:
Task<DataType> response = Fitness.getConfigClient(this, googleSigninAccount) .createCustomDataType(new DataTypeCreateRequest.Builder() .setName(DATA_TYPE_NAME) .addField(MY_FIELD1) .addField(MY_FIELD2) .build()); DataType dataType = Tasks.await(response);
Parameters | |
---|---|
request |
DataTypeCreateRequest : the new data type name and fields that need to be added |
Returns | |
---|---|
Task<DataType> |
a task , containing the status of the request. If an existing DataType has
the same name but different fields, the operation will fail with CONFLICTING_DATA_TYPE . If application package name does not match
DataType 's name, the operation will fail with INCONSISTENT_DATA_TYPE status code.
|
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 | |
---|---|
dataTypeName |
String : name of the data type we want to read |
Returns | |
---|---|
Task<DataType> |
Task containing the status of the request
|