解除與 Google Fit 的連結會撤銷應用程式所授予的所有 OAuth 權限,並移除應用程式所建立的所有錄製訂閱項目和感應器註冊項目。
您必須在應用程式設定中提供「Disconnect from Google Fit」選項,當使用者選取這個選項時,您可以呼叫 ConfigClient.disableFit 方法來停用 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));
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-25 (世界標準時間)。"],[[["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."]]],[]]