Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 655 Bytes

File metadata and controls

28 lines (24 loc) · 655 Bytes

Save Workout

Save workout to Healthkit

saveWorkout accepts an options object containing type, startDate, endDate, energyBurned and distance

let options = {
  type: 'AmericanFootball', // See HealthActivity Enum
  startDate: new Date(2016, 6, 2, 6, 0, 0).toISOString(),
  endDate: new Date(2020, 6, 2, 6, 30, 0).toISOString(),
  energyBurned: 50, // In Energy burned unit
  distance: 50, // In Distance unit
}
AppleHealthKit.saveWorkout(
  (options: Object),
  (err: Object, results: Object) => {
    if (err) {
      console.log('error saving workout to Healthkit: ', err)
      return
    }
    // Done
  },
)