Google Fit API を使用して上記のデータ型にアクセスするには、Android 10 ��それ以前のバージョンの Android の両方で Android 権限のリクエストを処理するロジックを実装する必要があります。これらの例では、ACTIVITY_RECOGNITION 権限を使用します。
Android 10
アプリは API レベル 29 以降をターゲットに設定し、ユーザーに権限をリクエストし、アプリケーション マニフェスト ファイルに権限を登録できます。
if(ContextCompat.checkSelfPermission(thisActivity,Manifest.permission.ACTIVITY_RECOGNITION)!=PackageManager.PERMISSION_GRANTED){// Permission is not granted}
[[["わかりやすい","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 UTC。"],[[["Android permissions protect user privacy by requiring apps to request access to sensitive data and system features."],["Apps need to request specific Android permissions before accessing certain Google Fit data types, such as activity, location, and heart rate data."],["Different data types require different permissions, like `ACTIVITY_RECOGNITION` for step count and activity data, `ACCESS_FINE_LOCATION` for location data, and `BODY_SENSORS` for heart rate data."],["Requesting Android permissions involves adding them to the manifest file and implementing logic to handle permission requests for different Android versions."],["Apps targeting older Android versions should be updated to handle potential permission revocations by users on Android 10 and above."]]],[]]