Nutrition

Nutrition

NutritionRecord in Health Connect. Check what the API exposes and what to look for when this data is missing or differs between apps.

API contract

Identifier
NutritionRecord
Time shape
Interval
Documented unit or dimension
Mass
Required record fields
endTimemealTypemetadatastartTime

Android Developers reference for NutritionRecord

Read a known time window

Run this inside a coroutine with an initialized Health Connect client, a start and end instant, and the required read grant. Follow the next-page token when checking a larger time range.

val page = healthConnectClient.readRecords(
    ReadRecordsRequest(
        NutritionRecord::class,
        timeRangeFilter = TimeRangeFilter.between(start, end)
    )
)
val records = page.records

Read and paginate Health Connect records

Manifest permissions in the Android documentation

Aggregate metrics (42)
  • NutritionRecord.BIOTIN_TOTAL
  • NutritionRecord.CAFFEINE_TOTAL
  • NutritionRecord.CALCIUM_TOTAL
  • NutritionRecord.CHLORIDE_TOTAL
  • NutritionRecord.CHOLESTEROL_TOTAL
  • NutritionRecord.CHROMIUM_TOTAL
  • NutritionRecord.COPPER_TOTAL
  • NutritionRecord.DIETARY_FIBER_TOTAL
  • NutritionRecord.ENERGY_FROM_FAT_TOTAL
  • NutritionRecord.ENERGY_TOTAL
  • NutritionRecord.FOLATE_TOTAL
  • NutritionRecord.FOLIC_ACID_TOTAL
  • NutritionRecord.IODINE_TOTAL
  • NutritionRecord.IRON_TOTAL
  • NutritionRecord.MAGNESIUM_TOTAL
  • NutritionRecord.MANGANESE_TOTAL
  • NutritionRecord.MOLYBDENUM_TOTAL
  • NutritionRecord.MONOUNSATURATED_FAT_TOTAL
  • NutritionRecord.NIACIN_TOTAL
  • NutritionRecord.PANTOTHENIC_ACID_TOTAL
  • NutritionRecord.PHOSPHORUS_TOTAL
  • NutritionRecord.POLYUNSATURATED_FAT_TOTAL
  • NutritionRecord.POTASSIUM_TOTAL
  • NutritionRecord.PROTEIN_TOTAL
  • NutritionRecord.RIBOFLAVIN_TOTAL
  • NutritionRecord.SATURATED_FAT_TOTAL
  • NutritionRecord.SELENIUM_TOTAL
  • NutritionRecord.SODIUM_TOTAL
  • NutritionRecord.SUGAR_TOTAL
  • NutritionRecord.THIAMIN_TOTAL
  • NutritionRecord.TOTAL_CARBOHYDRATE_TOTAL
  • NutritionRecord.TOTAL_FAT_TOTAL
  • NutritionRecord.TRANS_FAT_TOTAL
  • NutritionRecord.UNSATURATED_FAT_TOTAL
  • NutritionRecord.VITAMIN_A_TOTAL
  • NutritionRecord.VITAMIN_B12_TOTAL
  • NutritionRecord.VITAMIN_B6_TOTAL
  • NutritionRecord.VITAMIN_C_TOTAL
  • NutritionRecord.VITAMIN_D_TOTAL
  • NutritionRecord.VITAMIN_E_TOTAL
  • NutritionRecord.VITAMIN_K_TOTAL
  • NutritionRecord.ZINC_TOTAL

What to check when the value is missing

Check that the writing app saved a interval record under NutritionRecord and that the reading app has access to it. Start with a recent interval that contains a known record.

For a synthetic record, inspect mealType before comparing it with what the reader displays.

Compare the data origin and timestamp before looking at a daily dashboard. Check which of the listed metrics the app uses and which sources contribute to it.

Health Connect data types and feature requirements

Compare with Apple HealthKit

Dietary Protein dietaryProtein

Android can store multiple nutrients together. The Apple protein identifier stores an individual quantity. Keep the unit and timestamp and retain meal context separately if the writer provides it.

Dietary Energy Consumed dietaryEnergyConsumed

Android nutrition can bundle energy and nutrients. The Apple energy identifier stands on its own. Compare consumed energy independently of workout or resting energy.

Dietary Caffeine dietaryCaffeine

Health Connect can store caffeine among other meal fields. HealthKit treats it as its own quantity. Keep original source and units when converting to a common display.

API documentation checked . Examples are developer starting points based on the published API.