示例#1
0
 /*! @brief              Write a workout sample.
  *      @details
  *      @param activityType	The workout activity type to write.
  *      @param startDate	The starting date of the sample to write.
  *      @param endDate		The ending date of the sample to write.
  *      @param calories		The kilocalories burned during the activity
  *      @param distance		The distance traveled during the activity (for e.g. running)
  *      @param handler		Called when the function finishes executing.
  */
 public void WriteWorkoutSample(WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, double calories, double distance, WroteSample handler)
 {
     this.wroteSampleHandlers[HKDataType.HKWorkoutTypeIdentifier] = handler;
     if (this.IsHealthDataAvailable())
     {
         int identifier = (int)activityType;
         _WriteWorkout(identifier, DateTimeBridge.DateToString(startDate), DateTimeBridge.DateToString(endDate), calories, distance);
     }
     else
     {
         Debug.LogError("Error: no health data is available. Are you running on an iOS device that supports HealthKit?");
     }
 }
示例#2
0
 /*! @brief              Write a category sample.
  *      @details
  *      @param dataType		The datatype to write.
  *      @param value		the (integer) value to use to create a sample.
  *      @param startDate	The starting date of the sample to write.
  *      @param endDate		The ending date of the sample to write.
  *      @param handler		Called when the function finishes executing.
  */
 public void WriteCategorySample(HKDataType dataType, int value, DateTimeOffset startDate, DateTimeOffset endDate, WroteSample handler)
 {
     this.wroteSampleHandlers[dataType] = handler;
     if (this.IsHealthDataAvailable())
     {
         string identifier = HealthKitDataTypes.GetIdentifier(dataType);
         _WriteCategory(identifier, value, DateTimeBridge.DateToString(startDate), DateTimeBridge.DateToString(endDate));
     }
     else
     {
         Debug.LogError("Error: no health data is available. Are you running on an iOS device that supports HealthKit?");
     }
 }