Odłączanie od Google Fit
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Odłączenie od Google Fit powoduje cofnięcie wszystkich przyznanych uprawnień OAuth dla Twojej aplikacji oraz usunięcie wszystkich subskrypcji nagrywania i rejestracji czujników dokonanych przez Twoją aplikację.
W ustawieniach aplikacji musisz udostępnić użytkownikom opcję Odłącz od Google Fit. Gdy użytkownicy wybiorą tę opcję, możesz wywołać metodę ConfigClient.disableFit
, aby wyłączyć Google Fit:
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));
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-31 UTC.
[null,null,["Ostatnia aktualizacja: 2025-08-31 UTC."],[[["\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```"]]