Smartwatch Link - IOS - ios

How to take data from a smartwatch sensor and display it inside my own IOS health app
I expect that those data like heartbeat, calory burn and others are display in my health app

Related

iOS application reading in ECG data from healthkit instead of photoplethysmography

Last year I built an iOS application that reads in workouts from Healthkit. These workouts were recorded by the Apple Watch in built fitness application and gathers heart rate information using photoplethysmography (the light sensor in the watch before the ECG).
I want to get the new Apply Watch with the ECG monitor. If I record a workout in the same manner as above, will the data from the ECG still be passed into Healthkit and will my mobile application therefore be able to read the workout from Healthkit and all the relative heartrate data?
I'm hoping I don't need to perform any updates on my mobile application now that the apple watch has an ECG and not the photoplethysmography.
Does the new Apple Watch come with both photoplethysmography and the ECG or just the ECG?
As of iOS 14 and watchOS 7, you can now read an ECG sample as an HKElectrocardiogram.
https://developer.apple.com/videos/play/wwdc2020/10182/?t=105

Live HeartRate Stats on iOS from AppleWatch

Is it somehow possible to get live stats from the Apple-Watch about the users heart rate? Currently I only get callbacks on the watch as long as the app is open and the screen is active. Then I can send them to the Phone using the WCSession.
But having live stats on the phone without the watch being turned on is not possible, right?
I would have to query the HealthStore after the workout is completed? And how long would I have to wait on the phone after finishing my workout on the Watch for the Heart-Rate data to be synced?
What would be the best practice to add heart-rate data to my GPS trackpoints that I record? Just query the HealthStore some time after the activity and try to match the points by timestamp?
Any advice or tipps are very welcome :)
If you start a HKWorkoutSession on your Apple watch results are written to HealthKit in 5 second intervals (even if the watch screen is off). This data is automatically synced by Apple with your iPhone in the same 5 second intervals. If you create a health kit streaming query on your iPhone, you should be able to get "near live" stats. Take a look at this answer for more details on how to create a streaming health kit query.
Apps on watchOS may only run when the screen of the watch is on so practically speaking there is no way to reliably stream data, like the user's heart rate, from the watch to an app on the phone.
When the app on the watch does get an opportunity to run, it can collect heart rate samples from HealthKit and send them to the companion at that point.
Displaying live heart rate statistics on the phone is not possible because your app cannot control how frequently data is synced from the watch to the phone.

Handling Apple Watch sensors data in WatchKit app [duplicate]

This question already has answers here:
How to get sensor data from Apple Watch to iPhone?
(2 answers)
Closed 7 years ago.
I'm reading several articles and Apple's documents regarding Apple Watch and WatchKit development. It looks like third-party apps for Apple Watch like Strava and Runtastic will need you to also carry your iPhone while doing exercise to take and show data (as described in App Store Apps), but I don't find if the built-in apps (Activity and Workout) will also need it. It looks a bit uncomfortable having to carry your iPhone while running to be able to see your heart rate, speed and so on in the watch...
Regarding the data measured by the heart rate sensor and accelerometer integrated in the Apple Watch: is there an API that makes them accessible to third-parties developers?
And how is data mesaured by those sensors handled by the watch: is it directly sent to the paired iPhone as it is measured? It is temporarily and locally persisted in the watch until it is possible to send it to the iPhone? Is HealthKit available for WatchKit apps to handle such information?
Thanks in advance
Watchkit Sensor raw data information is now accessible with WatchKit for watchOS 2.0.
WatchOS 2 includes many enhancements to other existing frameworks such as HealthKit, enabling access to the health sensors that access heart rate and health information in real-time.
You could check this information in the following session which is total 30 minutes presentation. If you do not want to watch entire session, then you directly jump to Healthkit API features which is in between 25-28 min:
WatchKit watchOS 2.0 Session in WWDC 2015
I played with the Apple Watch at the Apple Watch lab.
The sensors and accelerometer are not accessible to devs.
You can go running without your phone and when you get home the heart rate data will 'eventually' be sent to Health on your phone, from which you can query data for your app. Any heart rate or sensor data saved on the Apple Watch cache is not accessible to dev.

HealthKit and accessories with no companion iOS apps

If I understand it correctly, HealthKit can automatically connect with bluetooth accessories of the following types - heart rate monitor, glucose sensor, blood pressure monitor, health thermometer.
There is no need to have companion apps for them as they can write the data directly (and of course wirelessly) to HealthKit.
I am just curious if it is true and if so do all these accessories work seamlessly with HealthKit. Is no configuration needed. Has anyone tried it.
Further there are some accessories (such as the iHealth blood pressure monitor) which do the measurement only once the measurement is initiated from the companion app. So how do those tie-in.
As of iOS 8, the system can import data from a BTLE heart rate monitor directly into HealthKit with no companion app. This can be configured in the Bluetooth settings pane of iOS.
There is a WWDC video that goes into more detail about this available here. Also, if you have an idea for a HealthKit accessory that is not supported currently, you should contact Apple with this form.
Despite what was said during WWDC 2014, it appears only Heart Rate is available.
From HKSource Class Reference:
Source objects represents the different data sources in HealthKit. These sources may include apps and devices whose data can be directly imported into the HealthKit store. Currently, HealthKit supports only the direct import of heart rate data from Bluetooth LE devices. All other devices need a companion app to collect and save the data to HealthKit.

Send custom data along with music (MP3) in iOS via Bluetooth

AIM: I am trying to integrate my iPhone app with a bluetooth device that can play music and display some visualisation (yet to choose bluetooth hardware). There are three things that puzzles me:
I have seen some sample programs that generate visualisation data based on averagePowerForChannel using AVAudioPlayer. Is it possible to extract such information for a music stored in iPhone filesystem without actually (or before) playing the music? Since iPhone apps cannot execute in background infinitely, extracting this data realtime may not advised?
Once I create this "visualisation" data for an mp3, can how can I send the data to my bluetooth device? I know we can sent custom data only via BLE. Is there a possibility that I can send music data and visualisation data to the bluetooth device at the same time?(or sent visualisation data for a few seconds first and then start streaming the music) - This advice will help me to choose a proper hardware, provided iPhone supports this!
If I cannot sent music data and visualisation data at the same time over bluetooth, I am planning to extract visualisation data first from the mp3(how?), send it over to be stored in the bluetooth device and then display accordingly, in sync with the music data received in real time. Is this possible?

Resources