ConfigClient
Stay organized with collections
Save and categorize content based on your preferences.
This class is deprecated.
For reading and writing historical fitness data, use Health Connect
instead.
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:
Task<DataType> response = Fitness.getConfigClient(this, googleSignInAccount)
.readDataType("com.example.my_custom_data_type");
DataType dataType = Tasks.await(response);
Inherited Method Summary
From class com.google.android.gms.common.api.GoogleApi
getApiFallbackAttributionTag
( Context
arg0)
From class java.lang.Object
Public Methods
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:
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
The new data type name and fields that need to be added.
public Task
< Void
>
disableFit
()
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.
Returns
-
Task
containing the status of the request.
public Task
< DataType
>
readDataType
( 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
dataTypeName
Name of the data type we want to read.
Returns
-
Task
containing the status of the request.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eConfigClient\u003c/code\u003e is deprecated and \u003cstrong\u003eHealth Connect\u003c/strong\u003e should be used for historical fitness data.\u003c/p\u003e\n"],["\u003cp\u003eIt provided access to custom data types and settings in Google Fit, but custom data type support is also deprecated.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003edisableFit()\u003c/code\u003e disconnects an app from Google Fit, revoking permissions and removing subscriptions.\u003c/p\u003e\n"],["\u003cp\u003eAccess \u003ccode\u003eConfigClient\u003c/code\u003e through the \u003ccode\u003eFitness\u003c/code\u003e entry point, as shown in the provided code example.\u003c/p\u003e\n"]]],[],null,["# ConfigClient\n\npublic class **ConfigClient** extends [GoogleApi](/android/reference/com/google/android/gms/common/api/GoogleApi)\\\u003c[Api.ApiOptions.HasGoogleSignInAccountOptions](/android/reference/com/google/android/gms/common/api/Api.ApiOptions.HasGoogleSignInAccountOptions)\\\u003e \n**This class is deprecated.** \n\nFor reading and writing historical fitness data, use [Health Connect](//developer.android.com/guide/health-and-fitness/health-connect)\ninstead.\n\nClient for accessing custom data types and settings in Google Fit.\n\nCustom [data type](/android/reference/com/google/android/gms/fitness/data/DataType)\ndefinitions can be added and then retrieved using [createCustomDataType(DataTypeCreateRequest)](/android/reference/com/google/android/gms/fitness/ConfigClient#createCustomDataType(com.google.android.gms.fitness.request.DataTypeCreateRequest)) and [readDataType(String)](/android/reference/com/google/android/gms/fitness/ConfigClient#readDataType(java.lang.String)).\n\n[disableFit()](/android/reference/com/google/android/gms/fitness/ConfigClient#disableFit())\ncan be used to disconnect your app from Google Fit.\n\nThe Config Client should be accessed via the [Fitness](/android/reference/com/google/android/gms/fitness/Fitness) entry\npoint. Example: \n\n```\n Task\u003cDataType\u003e response = Fitness.getConfigClient(this, googleSignInAccount)\n .readDataType(\"com.example.my_custom_data_type\");\n\n DataType dataType = Tasks.await(response);\n \n``` \n\n### Public Method Summary\n\n|---------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Task](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[DataType](/android/reference/com/google/android/gms/fitness/data/DataType)\\\u003e | [createCustomDataType](/android/reference/com/google/android/gms/fitness/ConfigClient#createCustomDataType(com.google.android.gms.fitness.request.DataTypeCreateRequest))([DataTypeCreateRequest](/android/reference/com/google/android/gms/fitness/request/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](/android/reference/com/google/android/gms/fitness/data/DataType).* |\n| [Task](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e | [disableFit](/android/reference/com/google/android/gms/fitness/ConfigClient#disableFit())() Disables Google Fit for an app. |\n| [Task](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[DataType](/android/reference/com/google/android/gms/fitness/data/DataType)\\\u003e | [readDataType](/android/reference/com/google/android/gms/fitness/ConfigClient#readDataType(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) 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](/android/reference/com/google/android/gms/fitness/data/DataType).* |\n\n### Inherited Method Summary\n\nFrom class com.google.android.gms.common.api.GoogleApi \n\n|-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| [String](//developer.android.com/reference/java/lang/String.html) | getApiFallbackAttributionTag([Context](//developer.android.com/reference/android/content/Context.html) arg0) |\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public [Task](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[DataType](/android/reference/com/google/android/gms/fitness/data/DataType)\\\u003e\n**createCustomDataType** ([DataTypeCreateRequest](/android/reference/com/google/android/gms/fitness/request/DataTypeCreateRequest) request)\n\n**This method is deprecated.** \n\nSupport for custom data types will be removed in a future version of Google Fit. Use one\nof the pre-defined data types listed in [DataType](/android/reference/com/google/android/gms/fitness/data/DataType). \nDefines a new data type which is added to the Google Fit platform on behalf of the\ncurrent application. Useful for adding a private custom data type for recording\napp-specific data. Custom data created by one app will not be visible to other\napps.\n\nExample: \n\n```\n Task\u003cDataType\u003e response = Fitness.getConfigClient(this, googleSignInAccount)\n .createCustomDataType(new DataTypeCreateRequest.Builder()\n .setName(DATA_TYPE_NAME)\n .addField(MY_FIELD1)\n .addField(MY_FIELD2)\n .build());\n DataType dataType = Tasks.await(response);\n \n``` \n\n##### Parameters\n\n| request | The new data type name and fields that need to be added. |\n|---------|----------------------------------------------------------|\n\n##### Returns\n\n- A [task](/android/reference/com/google/android/gms/tasks/Task), 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](/android/reference/com/google/android/gms/fitness/FitnessStatusCodes#CONFLICTING_DATA_TYPE). If application package name does not match [DataType](/android/reference/com/google/android/gms/fitness/data/DataType)'s name, the operation will fail with [FitnessStatusCodes.INCONSISTENT_DATA_TYPE](/android/reference/com/google/android/gms/fitness/FitnessStatusCodes#INCONSISTENT_DATA_TYPE) status code. \n\n#### public [Task](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e **disableFit** ()\n\nDisables Google Fit for an app. Can be used to revoke all granted OAuth access\npermissions from an app and consequently remove all existing subscriptions and\nregistrations of the app. \n\n##### Returns\n\n- [Task](/android/reference/com/google/android/gms/tasks/Task) containing the status of the request. \n\n#### public [Task](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[DataType](/android/reference/com/google/android/gms/fitness/data/DataType)\\\u003e\n**readDataType** ([String](//developer.android.com/reference/java/lang/String.html) dataTypeName)\n\n**This method is deprecated.** \n\nSupport for custom data types will be removed in a future version of Google Fit. Use one\nof the pre-defined data types listed in [DataType](/android/reference/com/google/android/gms/fitness/data/DataType). \nReturns a data type with the specified `dataTypeName`. Useful to retrieve\nshareable data types added by other apps or custom data types added by your app. Custom\ndata types created by other apps will not be returned. \n\n##### Parameters\n\n| dataTypeName | Name of the data type we want to read. |\n|--------------|----------------------------------------|\n\n##### Returns\n\n- [Task](/android/reference/com/google/android/gms/tasks/Task) containing the status of the request."]]