The Google Fit APIs, including the Google Fit REST API, will no longer be available after June 30, 2025. As of May 1, 2024, developers cannot sign up to use these APIs.
For instructions on which API or platform to migrate to, visit the Health Connect migration guide. For a comparison of Health Connect with the Google Fit APIs and the Fitbit Web APIs, visit the Health Connect comparison guide.
Learn more about Health Connect and how to integrate with the API.
Disconnect from Google Fit
Disconnecting from Google Fit revokes all granted OAuth permissions for your
app and removes all recording subscriptions and sensor registrations made by
your app.
You need to provide users with a Disconnect from Google Fit option
in your app settings. When users select this option, you can call the
ConfigClient.disableFit
method to disable Google Fit:
Fitness.getConfigClient(this, GoogleSignIn.getAccountForExtension(this, fitnessOptions))
.disableFit()
.addOnSuccessListener {
Log.i(TAG,"Disabled Google Fit")
}
.addOnFailureListener { e ->
Log.w(TAG,"There was an error disabling Google Fit", e)
}
Fitness.getConfigClient(this, GoogleSignIn.getAccountForExtension(this, fitnessOptions))
.disableFit()
.addOnSuccessListener(unused ->
Log.i(TAG, "Disabled Google Fit"))
.addOnFailureListener(e ->
Log.w(TAG, "There was an error disabling Google Fit", e));
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.
[null,null,["Last updated 2024-10-31 UTC."],[[["Disconnecting from Google Fit removes all app permissions, data recording subscriptions, and sensor registrations."],["Apps need to provide a \"Disconnect from Google Fit\" option, triggering the `ConfigClient.disableFit()` method for disconnection."],["`ConfigClient.disableFit()` revokes Google Fit access and stops data collection by the app."]]],[]]