Danh sách các loại dữ liệu

Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.

Health Connect hỗ trợ hơn 50 loại dữ liệu để cho phép người dùng đo mọi thứ từ tốc độ đạp xe đến nhiệt độ cơ thể.

Để xem danh sách đầy đủ các loại dữ liệu được hỗ trợ, vui lòng tham khảo Tài liệu tham khảo về Jetpack.

Health Connect hỗ trợ các loại dữ liệu dựa trên mức sử dụng phổ biến để cung cấp nhiều loại nhất có thể. Mục đích của Health Connect là cung cấp bộ nhớ lưu trữ và một cái nhìn toàn diện về dữ liệu sức khoẻ cũng như thể chất. Trước khi tham chiếu đến tệp đối chiếu Jetpack, hãy lưu ý rằng các loại dữ liệu của Health Connect sẽ thuộc các dạng sau:

  • Hoạt động: Mục này ghi lại mọi hoạt động người dùng thực hiện. Dữ liệu này có thể bao gồm các hoạt động về sức khoẻ và thể chất như chạy, bơi, thiền và ngủ.
  • Đo lường cơ thể: Mục này thu thập dữ liệu phổ biến liên quan đến cơ thể. Dữ liệu này bao gồm hồ sơ ghi lại trọng lượng của người dùng, tỷ lệ trao đổi chất cơ bản của người dùng cùng nhiều loại dữ liệu khác.
  • Theo dõi chu kỳ kinh nguyệt: Mục này ghi lại chu kỳ kinh nguyệt và các điểm dữ liệu liên quan, chẳng hạn như kết quả nhị phân của xét nghiệm rụng trứng.
  • Dinh dưỡng: Mục này thu thập các loại dữ liệu về lượng nước và dinh dưỡng. Phần trước thể hiện lượng nước một người dùng đã uống trong một lần uống. Phần sau bao gồm nhiều trường không bắt buộc, chẳng hạn như lượng calo, đường và magiê.
  • Dữ liệu giấc ngủ: Mục này thu thập dữ liệu khoảng thời gian liên quan đến thời lượng và kiểu ngủ của người dùng.
  • Chỉ số sức khoẻ: Mục này thu thập thông tin cần thiết về sức khoẻ tổng thể của người dùng. Dữ liệu này bao gồm dữ liệu như đường huyết, nhiệt độ cơ thể và độ bão hoà oxy trong máu.

Thuộc tính dữ liệu bổ sung

Dữ liệu trong API Health Connect cũng bao gồm các thuộc tính siêu dữ liệu được mô tả trong danh sách sau đây:

  • Mã nhận dạng trên Health Connect: Mỗi điểm dữ liệu được gán một mã nhận dạng duy nhất (UID) khi được tạo. Điều này rất hữu ích cho các hoạt động CRUD chuẩn.
  • Thời gian sửa đổi gần đây nhất: Mục này đánh dấu dấu thời gian của bản sao sau cùng mà một bản ghi có nội dung cập nhật. Hệ thống sẽ tự động tạo mục này vào lần tạo bản ghi đầu tiên hoặc vào mỗi lần cập nhật.
  • Nguồn gốc dữ liệu: Health Connect lưu trữ thông tin về ứng dụng cung cấp dữ liệu. Thông tin này cho bạn biết tên gói của nguồn gốc mà tại đó mục này được tự động thêm vào khi tạo.
  • Thiết bị: Health Connect lưu trữ thông tin về thiết bị cung cấp dữ liệu. Giá trị này cho bạn biết nhà sản xuất và kiểu máy của thiết bị mà bạn cung cấp giá trị theo cách thủ công.
  • Mã ứng dụng khách: Để hỗ trợ giải quyết xung đột và giúp đồng bộ hoá dễ dàng hơn, Health Connect cung cấp Mã ứng dụng khách để các ứng dụng có thể tham chiếu đến dữ liệu bằng mã của riêng chúng. Giá trị này được cung cấp cho bản ghi theo cách thủ công.
  • Phiên bản bản ghi của ứng dụng: Cùng với mã ứng dụng khách, Health Connect cung cấp phiên bản để giúp theo dõi các thay đổi khi đồng bộ hoá. Giá trị này được cung cấp cho bản ghi theo cách thủ công.

Giá trị nhận dạng duy nhất

Health Connect gán UID cho các đối tượng dữ liệu mới được thêm. Nhờ đó, bạn có thể xác định đối tượng dữ liệu và phân biệt các đối tượng đó với nhau, đặc biệt khi sử dụng trong yêu cầu đọc, cập nhật hoặc xoá. UID không giống với Mã ứng dụng khách. Ứng dụng khách gán Mã ứng dụng khách, trong khi Health Connect gán riêng UID.

Lưu ý rằng bạn cần nhớ các ghi chú sau đây khi làm việc với UID trong Health Connect:

  • Phiên hoạt động có một UID nhưng dữ liệu trong các phiên đó có UID riêng.
  • UID không gắn liền hoặc liên quan đến dấu thời gian.
  • Một số trường hợp sử dụng có thể yêu cầu lưu trữ một UID cụ thể trong quy trình làm việc. Ví dụ: truy xuất mục dữ liệu người dùng vừa ghi lại để hiển thị lại cho họ.

Thời gian trong Health Connect

Tất cả dữ liệu được ghi vào Health Connect phải nêu rõ thông tin về chênh lệch múi giờ. Nêu rõ sự chênh lệch múi giờ cho phép các ứng dụng đọc dữ liệu để biểu thị dữ liệu đó trong thời gian chính thức. Thời gian thực là thời gian theo giờ địa phương và liên quan đến người dùng, không nhất thiết phải là Giờ phối hợp quốc tế (UTC).

Trong một số ít trường hợp, sự chênh lệch múi giờ có thể không được áp dụng. Khi điều này xảy ra, bạn có thể ghi dữ liệu vào Health Connect mà không cần nêu rõ thông tin về chênh lệch múi giờ. Bạn nên tránh sử dụng tính năng này nếu có thể.

Đặt giờ và múi giờ

Việc nêu rõ thông tin về chênh lệch múi giờ trong quá trình ghi dữ liệu sẽ cung cấp thông tin về múi giờ khi đọc dữ liệu trong Health Connect. Tuy nhiên, việc này có thể không thực hiện được trong một số trường hợp, chẳng hạn như khi bạn không cung cấp thông tin về chênh lệch múi giờ. Ứng dụng của bạn cần được chuẩn bị để xử lý cả hai loại dữ liệu theo cách phù hợp cho các trường hợp cụ thể.

Quyền

Trước khi yêu cầu quyền, ứng dụng phải khai báo trước các quyền đó trong tệp kê khai. Hãy xem các bảng sau đây để biết cách liên kết đầy đủ các loại dữ liệu với quyền.

Đối với "alpha10" trở lên

Loại lớp bản ghi Đọc và ghi thông tin khai báo quyền
ActiveCaloriesBurned android.permission.health.READ_ACTIVE_CALORIES_BURNED
android.permission.health.WRITE_ACTIVE_CALORIES_BURNED
BasalBodyTemperature android.permission.health.READ_BASAL_BODY_TEMPERATURE
android.permission.health.WRITE_BASAL_BODY_TEMPERATURE
BasalMetabolicRate android.permission.health.READ_BASAL_METABOLIC_RATE
android.permission.health.WRITE_BASAL_METABOLIC_RATE
BloodGlucose android.permission.health.READ_BLOOD_GLUCOSE
android.permission.health.WRITE_BLOOD_GLUCOSE
BloodPressure android.permission.health.READ_BLOOD_PRESSURE
android.permission.health.WRITE_BLOOD_PRESSURE
BodyFat android.permission.health.READ_BODY_FAT
android.permission.health.WRITE_BODY_FAT
BodyTemperature android.permission.health.READ_BODY_TEMPERATURE
android.permission.health.WRITE_BODY_TEMPERATURE
BodyWaterMass android.permission.health.READ_BODY_WATER_MASS
android.permission.health.WRITE_BODY_WATER_MASS
BoneMass android.permission.health.READ_BONE_MASS
android.permission.health.WRITE_BONE_MASS
CervicalMucus android.permission.health.READ_CERVICAL_MUCUS
android.permission.health.WRITE_CERVICAL_MUCUS
CyclingPedalingCadence android.permission.health.READ_EXERCISE
android.permission.health.WRITE_EXERCISE
Distance android.permission.health.READ_DISTANCE
android.permission.health.WRITE_DISTANCE
ElevationGained android.permission.health.READ_ELEVATION_GAINED
android.permission.health.WRITE_ELEVATION_GAINED
ExerciseSession android.permission.health.READ_EXERCISE
android.permission.health.WRITE_EXERCISE
FloorsClimbed android.permission.health.READ_FLOORS_CLIMBED
android.permission.health.WRITE_FLOORS_CLIMBED
HeartRate android.permission.health.READ_HEART_RATE
android.permission.health.WRITE_HEART_RATE
HeartRateVariabilityRmssd android.permission.health.READ_HEART_RATE_VARIABILITY
android.permission.health.WRITE_HEART_RATE_VARIABILITY
Height android.permission.health.READ_HEIGHT
android.permission.health.WRITE_HEIGHT
Hydration android.permission.health.READ_HYDRATION
android.permission.health.WRITE_HYDRATION
IntermenstrualBleeding android.permission.health.READ_INTERMENSTRUAL_BLEEDING
android.permission.health.WRITE_INTERMENSTRUAL_BLEEDING
LeanBodyMass android.permission.health.READ_LEAN_BODY_MASS
android.permission.health.WRITE_LEAN_BODY_MASS
MenstruationFlow android.permission.health.READ_MENSTRUATION
android.permission.health.WRITE_MENSTRUATION
MenstruationPeriod android.permission.health.READ_MENSTRUATION
android.permission.health.WRITE_MENSTRUATION
Nutrition android.permission.health.READ_NUTRITION
android.permission.health.WRITE_NUTRITION
OvulationTest android.permission.health.READ_OVULATION_TEST
android.permission.health.WRITE_OVULATION_TEST
OxygenSaturation android.permission.health.READ_OXYGEN_SATURATION
android.permission.health.WRITE_OXYGEN_SATURATION
Power android.permission.health.READ_POWER
android.permission.health.WRITE_POWER
RespiratoryRate android.permission.health.READ_RESPIRATORY_RATE
android.permission.health.WRITE_RESPIRATORY_RATE
RestingHeartRate android.permission.health.READ_RESTING_HEART_RATE
android.permission.health.WRITE_RESTING_HEART_RATE
SexualActivity android.permission.health.READ_SEXUAL_ACTIVITY
android.permission.health.WRITE_SEXUAL_ACTIVITY
SleepSession android.permission.health.READ_SLEEP
android.permission.health.WRITE_SLEEP
SleepStage android.permission.health.READ_SLEEP
android.permission.health.WRITE_SLEEP
Speed android.permission.health.READ_SPEED
android.permission.health.WRITE_SPEED
StepsCadence android.permission.health.READ_STEPS
android.permission.health.WRITE_STEPS
Steps android.permission.health.READ_STEPS
android.permission.health.WRITE_STEPS
TotalCaloriesBurned android.permission.health.READ_TOTAL_CALORIES_BURNED
android.permission.health.WRITE_TOTAL_CALORIES_BURNED
Vo2Max android.permission.health.READ_VO2_MAX
android.permission.health.WRITE_VO2_MAX
Weight android.permission.health.READ_WEIGHT
android.permission.health.WRITE_WEIGHT
WheelchairPushes android.permission.health.READ_WHEELCHAIR_PUSHES
android.permission.health.WRITE_WHEELCHAIR_PUSHES

Đối với "alpha09" trở xuống

Loại lớp bản ghi Đọc và ghi thông tin khai báo quyền
ActiveCaloriesBurned androidx.health.permission.ActiveCaloriesBurned.READ
androidx.health.permission.ActiveCaloriesBurned.WRITE
BasalBodyTemperature androidx.health.permission.BasalBodyTemperature.READ
androidx.health.permission.BasalBodyTemperature.WRITE
BasalMetabolicRate androidx.health.permission.BasalMetabolicRate.READ
androidx.health.permission.BasalMetabolicRate.WRITE
BloodGlucose androidx.health.permission.BloodGlucose.READ
androidx.health.permission.BloodGlucose.WRITE
BloodPressure androidx.health.permission.BloodPressure.READ
androidx.health.permission.BloodPressure.WRITE
BodyFat androidx.health.permission.BodyFat.READ
androidx.health.permission.BodyFat.WRITE
BodyTemperature androidx.health.permission.BodyTemperature.READ
androidx.health.permission.BodyTemperature.WRITE
BodyWaterMass androidx.health.permission.BodyWaterMass.READ
androidx.health.permission.BodyWaterMass.WRITE
BoneMass androidx.health.permission.BoneMass.READ
androidx.health.permission.BoneMass.WRITE
CervicalMucus androidx.health.permission.CervicalMucus.READ
androidx.health.permission.CervicalMucus.WRITE
CyclingPedalingCadence androidx.health.permission.CyclingPedalingCadence.READ
androidx.health.permission.CyclingPedalingCadence.WRITE
Distance androidx.health.permission.Distance.READ
androidx.health.permission.Distance.WRITE
ElevationGained androidx.health.permission.ElevationGained.READ
androidx.health.permission.ElevationGained.WRITE
ExerciseSession androidx.health.permission.ExerciseSession.READ
androidx.health.permission.ExerciseSession.WRITE
FloorsClimbed androidx.health.permission.FloorsClimbed.READ
androidx.health.permission.FloorsClimbed.WRITE
HeartRate androidx.health.permission.HeartRate.READ
androidx.health.permission.HeartRate.WRITE
HeartRateVariabilityRmssd androidx.health.permission.HeartRateVariabilityRmssd.READ
androidx.health.permission.HeartRateVariabilityRmssd.WRITE
Height androidx.health.permission.Height.READ
androidx.health.permission.Height.WRITE
Hydration androidx.health.permission.Hydration.READ
androidx.health.permission.Hydration.WRITE
IntermenstrualBleeding androidx.health.permission.IntermenstrualBleeding.READ
androidx.health.permission.IntermenstrualBleeding.WRITE
LeanBodyMass androidx.health.permission.LeanBodyMass.READ
androidx.health.permission.LeanBodyMass.WRITE
MenstruationFlow androidx.health.permission.MenstruationFlow.READ
androidx.health.permission.MenstruationFlow.WRITE
Nutrition androidx.health.permission.Nutrition.READ
androidx.health.permission.Nutrition.WRITE
OvulationTest androidx.health.permission.OvulationTest.READ
androidx.health.permission.OvulationTest.WRITE
OxygenSaturation androidx.health.permission.OxygenSaturation.READ
androidx.health.permission.OxygenSaturation.WRITE
Power androidx.health.permission.Power.READ
androidx.health.permission.Power.WRITE
RespiratoryRate androidx.health.permission.RespiratoryRate.READ
androidx.health.permission.RespiratoryRate.WRITE
RestingHeartRate androidx.health.permission.RestingHeartRate.READ
androidx.health.permission.RestingHeartRate.WRITE
SexualActivity androidx.health.permission.SexualActivity.READ
androidx.health.permission.SexualActivity.WRITE
SleepSession androidx.health.permission.SleepSession.READ
androidx.health.permission.SleepSession.WRITE
SleepStage androidx.health.permission.SleepSession.READ
androidx.health.permission.SleepSession.WRITE
Speed androidx.health.permission.Speed.READ
androidx.health.permission.Speed.WRITE
StepsCadence androidx.health.permission.StepsCadence.READ
androidx.health.permission.StepsCadence.WRITE
Steps androidx.health.permission.Steps.READ
androidx.health.permission.Steps.WRITE
TotalCaloriesBurned androidx.health.permission.TotalCaloriesBurned.READ
androidx.health.permission.TotalCaloriesBurned.WRITE
Vo2Max androidx.health.permission.Vo2Max.READ
androidx.health.permission.Vo2Max.WRITE
Weight androidx.health.permission.Weight.READ
androidx.health.permission.Weight.WRITE
WheelchairPushes androidx.health.permission.WheelchairPushes.READ
androidx.health.permission.WheelchairPushes.WRITE