Health and Fitness

RSS for tag

Use HealthKit to enable your iOS and watchOS apps to work with the Apple Health app.

Posts under Health and Fitness tag

72 Posts
Sort by:
Post not yet marked as solved
1 Replies
566 Views
When I finish Running on AppleWatch, I can see the value of average cadence on Apple Watch's Workout App and iPhone's Fitness App, but I can't find any APIs about that value.However I'm not sure how does Fitness App calculated, I tried to get step count from HealthKit, and calculated the value, but the value is different from Apple's. Can you tell me how to get it correctly and accurately?
Posted
by Iara.
Last updated
.
Post marked as solved
1 Replies
226 Views
I am currently working on an app that compiles sensor data to a csv file for use in health applications. This data is collected in the background via HKWorkoutSession. I'm not using any data from the healthstore, however, it is needed to start the workout session. During background run time, the apple watch continuously runs the heartrate monitor (the green light on the back of the watch). Is there any way to disable this light from turning on? This app must maintain a low battery usage profile so it may run continuously for 12+ hours, however, the heart rate sensor chews through battery life.
Posted
by jlawle.
Last updated
.
Post not yet marked as solved
1 Replies
217 Views
Do I have to pay when I use healthKit in my app? Would you tell me how does it cost or provide related documents? I want to know really detailed information cause the app has many users
Posted
by Seonyoung.
Last updated
.
Post not yet marked as solved
1 Replies
378 Views
To whom it may concern, After reviewing the documents, we realized that SensorKit is available only for the research study. I'm writing this email to ask two questions regarding the purpose of Sensorkit. First, Are you planning to open the Sensorkit for regular apps with a focus on health and wellness or it's going to be limited to only Research? Second, if it's going to be limited to only research, then what would be the goal of the app/research if we can't provide to everyone and scale the business (of course with user permission and consent)? I appreciate your time in advance and looking forward to hearing from you. Thanks, Mohsen
Posted Last updated
.
Post not yet marked as solved
0 Replies
227 Views
I've noticed a bug in my app recently, it appears that in watchOS 8.5 (or earlier) that page layout is no longer initializing or awakingWithContext the pages beyond the first index. According to the documentation: In a page-based interface, all interface controllers are initialized up front but only the first one is displayed initially. https://developer.apple.com/documentation/watchkit/wkinterfacecontroller/1619521-init I am simply not seeing this happen anymore. I have logging in all of the lifecycle method of all three of my pages and the second and third controllers don't fire anything (including init) until I swipe to the right. This is when I would expect the willActivate and didActivate methods to be invoked. Instead I get init, awake, willActivate, and then didActivate. :/ This is unfortunate and a bug to the user because the second controller asks to becomeCurrent under some certain conditions that the first detects and fires via NotificationCenter. The automatic programatic switching between pages is totally broken. FB9972047
Posted
by edorphy.
Last updated
.
Post marked as Apple Recommended
615 Views
Is it possible to update the UI of an application written in WatchKit (not SwiftUI) while the watch is lowered and the device is in always-on mode? I am wanting to continue to update a WKInterfaceTimer label (which shows minutes and seconds) and a couple of WKInterfaceLabel which show live HealthKit info for a fitness app. I can't seem to see any Watchkit APIs for this and if I do not pause a WKInterfaceTimer when the didDeactivate is called on a WKInterfaceController the it still seems to pause when the app is put into always on mode.
Posted
by radox1.
Last updated
.
Post not yet marked as solved
0 Replies
169 Views
Hi! Ever since I set bedtime mode on my iPhone, it automatically turns on at night, which is great! However, is there a way that I can set my phone to automatically turn bedtime mode off at a specific time in the morning? Right now I have to manually switch it off every single morning. Thank you!
Posted
by HazyD98.
Last updated
.
Post not yet marked as solved
0 Replies
203 Views
Hello! Today I worked for the first time with Apple Health Kit and successfully saved a workout in Health with the basic informations (activityType, start and end). My app is in basic function an interval timer where you can create your own workout. Now in the next step I want to add the calories burned in the workout. This information is stored in the attribute 'totalEnergyBurned'. Do I need to calculate this value myself or can I query this value directly if the user is wearing an Apple Watch? Or maybe the value is even automatically added to the workout if there is the corresponding record? (So far I have only tested the app in the simulator, which is why I can't answer this possibility). My current code: func saveToHealthKit(entryID: String){             if HKHealthStore.isHealthDataAvailable() {                 let healthStore = HKHealthStore()                 if(healthStore.authorizationStatus(for: HKObjectType.workoutType()) == .sharingAuthorized && healthStore.authorizationStatus(for: HKObjectType.quantityType(forIdentifier: HKQuantityTypeIdentifier.activeEnergyBurned)!) == .sharingAuthorized){                     let newWorkout = HKWorkout(activityType: HKWorkoutActivityType.highIntensityIntervalTraining, start: entry.date!, end: Date())                     healthStore.save(newWorkout) { success, error in                         guard success else {                             // Perform proper error handling here.                             return                         }                                                  // Add detail samples here.                     }                 }             }         }     } Thanks :)
Posted
by KLukas.
Last updated
.
Post not yet marked as solved
0 Replies
258 Views
I have a problem with Apple HealthKit authorization. Everything worked fine until update of Xcode to version 13.3. It seems that that request for authorization is not fired, even when I explicitly declared that I want to request authorization onAppear of ContentView. This is code for ContentView: import SwiftUI struct ContentView: View { @EnvironmentObject var firebaseManager: FirebaseManager @EnvironmentObject var healthkitManager: HealthKitManager var body: some View { NavigationView { if firebaseManager.signedIn { HomePageView() } else { SignInView() } } .onAppear { healthkitManager.authorizeHealthKit() firebaseManager.signedIn = firebaseManager.isSignedIn } } } Function in HealthKitManager looks like this: func authorizeHealthKit() { //Check to see if HealthKit Is Available on this device guard HKHealthStore.isHealthDataAvailable() else { print("HealthKit data not available on this device") return } // Set types to read and write in HealthStore let typesToRead: Set = [ HKObjectType.characteristicType(forIdentifier: .dateOfBirth)!, HKObjectType.quantityType(forIdentifier: .bloodGlucose)!, HKObjectType.quantityType(forIdentifier: .insulinDelivery)!, HKObjectType.quantityType(forIdentifier: .dietaryCarbohydrates)!, HKObjectType.quantityType(forIdentifier: .stepCount)!, HKObjectType.quantityType(forIdentifier: .heartRate)!, HKObjectType.quantityType(forIdentifier: .appleExerciseTime)!, ] let typesToWrite: Set = [ HKObjectType.quantityType(forIdentifier: .bloodGlucose)!, HKObjectType.quantityType(forIdentifier: .insulinDelivery)!, HKObjectType.quantityType(forIdentifier: .dietaryCarbohydrates)!, ] // Request authorization for those quantity types. healthStore.requestAuthorization(toShare: typesToWrite, read: typesToRead) { (success, error) in } } I've tried to add key Privacy - Health Update Usage Description and Privacy - Health Share Usage Description with some string values to Info tab in project file, but still nothing. When I build application, I get this in console: [auth] FAILED prompting authorization request to share ( HKQuantityTypeIdentifierBloodGlucose, HKQuantityTypeIdentifierDietaryCarbohydrates, HKQuantityTypeIdentifierInsulinDelivery ), read ( HKCharacteristicTypeIdentifierDateOfBirth, HKQuantityTypeIdentifierHeartRate, HKQuantityTypeIdentifierBloodGlucose, HKQuantityTypeIdentifierInsulinDelivery, HKQuantityTypeIdentifierDietaryCarbohydrates, HKQuantityTypeIdentifierAppleExerciseTime, HKQuantityTypeIdentifierStepCount ) I read some articles, tried multiple possible solutions, restarted my Mac, but everything without success. Should there be a problem because I have two environment object? I'll be thankful for any ideas...
Posted
by marekdado.
Last updated
.
Post not yet marked as solved
1 Replies
639 Views
Lately we are experiencing some crashes / system terminations in our app, due to "exhausted real (wall clock) time allowance of 10.00 seconds". I never was able to reproduce the issue, but my client states that it happened for him multiple times in a row. He sent me 2 crash reports, and both of them have the same structure: The main thread blocked in [HKHealthStore authorizationStatusForType:] / semaphore_wait_trap 'Elapsed total CPU time' high, while 'Elapsed application CPU time' very low (like 0.006, 0% CPU in the following report) He also sent me a 'wakeups report' together with the crash reports ("exceeding limit of 150 wakeups per second over 300 seconds"), maybe it can be related? Did somebody encounter something similar or has any thoughts what could be the root cause? Thank you very much in advance, Full crash report attached. Crash report I also attached a code snippet; the following method is called on the main thread when an alert controller is dismissed: func saveCyclingDistanceWorkout(distance:Double, startDate:Date, endDate:Date, workoutMetadata: WorkoutMetadata, workoutRouteBuilder: Any? = nil, completion: ((Bool, NSError?) -> Void)? = nil) {         // Check if permission is still enabled for cycling distance, else show error         var shouldUseCyclingDistance = true         let cyclingDistanceAuthorizationStatus = healthStore.authorizationStatus(for: HKObjectType.quantityType(forIdentifier: HKQuantityTypeIdentifier.distanceCycling)!)         if cyclingDistanceAuthorizationStatus == .notDetermined || cyclingDistanceAuthorizationStatus == .sharingDenied {             shouldUseCyclingDistance = false         }         ...
Posted Last updated
.
Post not yet marked as solved
3 Replies
417 Views
Can Apple Watch provide complete data on the heartbeat for thousands of seconds during the workout or when using the "Breathe" app? When I exported data from Apple Health it shows the following data. The rows 195, 196 & 197 are measurements taken through the "Breathe" app. Thank you for your answers,
Posted Last updated
.
Post not yet marked as solved
1 Replies
392 Views
So the documentation here only says: A quantity sample type that measures the standard deviation of heartbeat intervals. And below: Discussion These samples use time units (described in HKUnit) and measure discrete values (described in HKStatisticsQuery). HealthKit calculates the Heart rate variability (HRV) by measuring the variation between individual heartbeats. While there are multiple ways of computing HRV, HealthKit uses SDNN heart rate variability, which uses the standard deviation of the inter-beat (RR) intervals between normal heartbeats (typically measured in milliseconds). There is no details on how many heartbeat intervals are used to calculate the SDNN and how to modify it. What if I want to calculate the SDNN on the last 30 intervals? Or the last 10? or the last 100? Or maybe I just want to calculate it on a timeframe, like 60 seconds, regardless of there were 50 or 120 heartbeats.
Posted
by MrMarch.
Last updated
.
Post not yet marked as solved
0 Replies
247 Views
Wouldn’t it be dope to track your reading same way you can track your relaxation in your watch os but instead you get achievements for increasing your study times? Remove the 5 minute limitation, is anything help college students and all students alike follow a custom study pattern for example : I would like to study about 8 hours this week the watch can help me best fit it in my schedule keep track of my time when i am reading or studying and then give me dope achievements for doing so and even credit for your apple reads store so I can buy a book or two. Make studying fun, include me in this plan I’m down if your down I’m having with this because i believe its a great idea. ( jk ik you’re not obligated to include me in anything ).
Posted Last updated
.
Post not yet marked as solved
0 Replies
194 Views
Hello, I have problem with submision from App Store I use to activity ring in Watch extension in my App. I use activity rings to plot the values that the application has, but my application is not primarily intended for fitness. I enter my values that are obtained from the application in Iphone into the rings activity. how can I use activity rings to allow the app store to upload the app? can I use activitity rings without health kit? Issue with submission Guideline 2.5.1 - Performance - Software Requirements We noticed that your app uses HealthKit, but your app does not appear to include any primary features that require health or fitness data.  The intended use of HealthKit is generally to share health or fitness data with other apps or devices as a part of the app's core functionality.  Next Steps To resolve this issue, please remove any HealthKit functionality from your app, as well as any references to this app’s interactivity with HealthKit from the app or its metadata. This includes removing any HealthKit-related keys in your app's Info.plist as well as removing any calls to HealthKit APIs, including those from 3rd party platforms, from your app.
Posted
by Radim007.
Last updated
.
Post not yet marked as solved
2 Replies
717 Views
Hi, I have a problem with HealthKit. When fetching sleepAnalysis, instead of getting a record for every night, I get multiple records for each night. How can I calculate the total amount of time for every day from the startDate and the endDate of every record? Thanks.
Posted
by borto_ale.
Last updated
.
Post not yet marked as solved
0 Replies
177 Views
Our app supports SmartCardHealth and Apple Wallet-Health integration. We have seen an issue, when we try to add vaccine records with same Vaccine dose details of different users, the wallet app is taking the first one only the later one got automatically replaced by first showing the message "The Vaccination records already added" in Health app. Please help in resolving this issue, whether if have missed out any parameter in minified JSON response. Below are the response for our test records {"resource":{"vaccineCode":{"coding":[{"system":http://hl7.org/fhir/sid/cvx,"code":"208"}]},"status":"completed","resourceType":"Immunization","performer":[{"actor":{"display":"TESTING PREPMOD"}}],"patient":{"reference":"resource:0"},"occurrenceDateTime":"2022-01-23","lotNumber":"TESTAUTOMATIONLOTNUMBER_D"},"fullUrl":"resource:1"}]}}},"nbf":1643984735,"iss":https://health.ri.gov/sh.cards/test}   {"resource":{"vaccineCode":{"coding":[{"system":http://hl7.org/fhir/sid/cvx,"code":"208"}]},"status":"completed","resourceType":"Immunization","performer":[{"actor":{"display":"TESTING PREPMOD"}}],"patient":{"reference":"resource:0"},"occurrenceDateTime":"2022-01-23","lotNumber":"TESTAUTOMATIONLOTNUMBER_D"},"fullUrl":"resource:1"}]}}},"nbf":1643984914,"iss":https://health.ri.gov/sh.cards/test}
Posted Last updated
.
Post not yet marked as solved
2 Replies
766 Views
FITPASS app is already on the App Store, but we were rejected during the last review. The app is available here - https://apps.apple.com/in/app/fitpass-gyms-fitness-pass/id1049745078 The reason from the review team is that - 4 Safety: Physical Harm 5 Performance: Software Requirements Guideline 1.4.1 - Safety - Physical Harm Your app provides health or medical recommendations, calculations, references, wellness reports, or diagnoses without including the sources of the recommendations. FITPASS only calculating customer BMI and RMR. We do not understand where is the problem and why the app was approved multiple times and now not. Can anyone help us to understand where can be a problem? please suggest someone
Posted Last updated
.