Google Fit REST API を含む Google Fit API は、2026 年に非推奨になります。2024 年 5 月 1 日より、デベロッパーはこれらの API の使用を登録できなくなります。
移行先の API またはプラットフォームの手順については、ヘルスコネクトの移行ガイドをご覧ください。ヘルスコネクトと Google Fit API および Fitbit Web API の比較については、ヘルスコネクトの比較ガイドをご覧ください。
ヘルスコネクトの詳細と API との統合方法をご覧ください。
データの帰属表示
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Google Fit のすべてのデータポイントには、データソースが関連付けられています。データソースには、データを収集または変換するアプリやデバイスを特定するための情報が含まれています。
REST API を使用すると、フィットネス データを挿入したアプリを特定できます。たとえば、ユーザーのフィットネス履歴からさまざまなデータを分析するアプリでは、分析に含まれるフィットネス セッションのリストと、各セッションを挿入したアプリに関する情報をユーザーに提供できます。
REST API では、フィットネス ストアに挿入したデータをアプリケーションに関連付けることもできます。
データを挿入したアプリケーションを特定する
セッションを挿入した Android アプリのパッケージ名、またはセッションを挿入した REST アプリケーションの名前を取得するには:
- セッションを取得します。
session.application.packageName
プロパティまたは session.application.name
プロパティを読み取ります。
Android アプリのパッケージ名、またはデータセットを挿入した REST アプリケーションの名前を取得するには:
- データセットを取得します。
dataset.dataSourceId
プロパティを読み取って、データソースを取得します。
dataSources.application.packageName
プロパティまたは dataSources.application.name
プロパティを読み取ります。
application
プロパティには次のフィールドがあります。
name
- アプリケーションの名前。
packageName
- Android アプリのパッケージ名。
detailsUrl
- (省略可)アプリにリンクする URI。
特定の時間間隔で使用可能なすべてのセッションをアプリに表示すると、この情報を使用して、各セッションを挿入したアプリをユーザーに示すことができます。
フィットネス ストアに挿入したデータをアプリに関連付けるには、次のことを確認してください。
挿入されたデータにアクセスするアプリは、この情報を使用して、そのデータをアプリに帰属させることができます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eEvery data point in Google Fit is linked to a data source, which identifies the source app or device.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Fit REST API allows you to identify the app that inserted specific fitness data, like sessions or datasets.\u003c/p\u003e\n"],["\u003cp\u003eYou can attribute data you insert into Google Fit to your application by including application details when creating data sources.\u003c/p\u003e\n"],["\u003cp\u003eThis attribution allows other apps to correctly identify your application as the source of the data.\u003c/p\u003e\n"]]],[],null,["# Data Attribution\n\nEvery data point in Google Fit has an associated data source. Data sources contain\ninformation to identify the app or the device that collects or transforms the data.\n\nThe REST API lets you determine which app inserted fitness data.\nFor example, an app that analyzes a variety of data from the user's fitness history may\nwant to present users with the list of fitness sessions included in the analysis, along with\ninformation about which app inserted each session.\n\nThe REST API also lets you associate data that you insert in the fitness store with your\napplication.\n\nDetermine which application inserted data\n-----------------------------------------\n\nTo obtain the package name of the Android application that inserted a session or\nthe name of the REST application that inserted a session:\n\n1. Retrieve the session.\n2. Read the [`session.application.packageName`](/fit/rest/v1/reference/users/sessions/list#session.application.packageName) or [`session.application.name`](/fit/rest/v1/reference/users/sessions/list#session.application.name) property.\n\nTo obtain the package name of the Android application or\nthe name of the REST application that inserted a dataset:\n\n1. Retrieve the dataset.\n2. Retrieve the data source by reading the [`dataset.dataSourceId`](/fit/rest/v1/reference/users/dataSources/datasets#dataSourceId) property.\n3. Read the [`dataSources.application.packageName`](/fit/rest/v1/reference/users/dataSources#application.packageName) or [`dataSources.application.name`](/fit/rest/v1/reference/users/dataSources#application.name) property.\n\nThe `application` property contains these fields:\n\n`name`\n: The name of the application.\n\n`packageName`\n: The package name of the Android application.\n\n`detailsUrl`\n: (Optional) A URI to link to the application.\n\nWhen you list all available sessions for a time interval in your application, you can\nuse this information to show your users which app inserted each session.\n\nProvide information about your application\n------------------------------------------\n\nTo attribute data you insert into the fitness store to your application, ensure that:\n\n- You add your application details to the [`dataSources.application`](/fit/rest/v1/reference/users/dataSources#application) property when creating data sources.\n- You specify the correct [`datasets.dataSourceId`](/fit/rest/v1/reference/users/dataSources/datasets) for your data source when adding points to datasets.\n\nApplications accessing data you inserted can use this information to attribute that data to your\napplication."]]