解除与 Google 健身的关联
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
解除与 Google 健身的关联会撤消为您的应用授予的所有 OAuth 权限,并移除您的应用进行的所有记录订阅和传感器注册。
您需要在应用设置中向用户提供解除与 Google 健身的关联选项。当用户选择此选项后,您可以调用
ConfigClient.disableFit
停用 Google 健身的方法:
Kotlin
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)
}
Java
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));
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eDisconnecting from Google Fit removes all app permissions, data recording subscriptions, and sensor registrations.\u003c/p\u003e\n"],["\u003cp\u003eApps need to provide a "Disconnect from Google Fit" option, triggering the \u003ccode\u003eConfigClient.disableFit()\u003c/code\u003e method for disconnection.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eConfigClient.disableFit()\u003c/code\u003e revokes Google Fit access and stops data collection by the app.\u003c/p\u003e\n"]]],[],null,["# Disconnect from Google Fit\n\nDisconnecting from Google Fit revokes all granted OAuth permissions for your\napp and removes all recording subscriptions and sensor registrations made by\nyour app.\n\nYou need to provide users with a **Disconnect from Google Fit** option\nin your app settings. When users select this option, you can call the\n[`ConfigClient.disableFit`](/android/reference/com/google/android/gms/fitness/ConfigClient#public-taskvoid-disablefit)\nmethod to disable Google Fit: \n\n### Kotlin\n\n```kotlin\nFitness.getConfigClient(this, GoogleSignIn.getAccountForExtension(this, fitnessOptions))\n .disableFit()\n .addOnSuccessListener {\n Log.i(TAG,\"Disabled Google Fit\")\n }\n .addOnFailureListener { e -\u003e\n Log.w(TAG,\"There was an error disabling Google Fit\", e)\n }\n```\n\n### Java\n\n```java\nFitness.getConfigClient(this, GoogleSignIn.getAccountForExtension(this, fitnessOptions))\n .disableFit()\n .addOnSuccessListener(unused -\u003e\n Log.i(TAG, \"Disabled Google Fit\"))\n .addOnFailureListener(e -\u003e\n Log.w(TAG, \"There was an error disabling Google Fit\", e));\n```"]]