dwyl / learn-apple-watch-development

:green_book: Learn how to build Native Apple Watch (+iPhone) apps from scratch!
55 stars 5 forks source link

Investigate Heart Rate and Accelerometer APIs on Apple Watch for Automatic Activity Tracking #35

Open nelsonic opened 7 years ago

nelsonic commented 7 years ago

Hi @sohilpandya, Hope your morning is going well! Hope your neck is feeling much better and you're $.ready() to receive your next mission! 😉

You've done a great job so far of building the (Alpha) Time App and it's going to be even better once our API is Live!

Ideal "User Story"

As a person using the dwyl app I want to track my activities automatically So that I don't have to think about (remember to) manually start a timer on my device/app

As you recall from our initial discussion last November on doing Apple Watch Development, the reason for having an Apple Watch (Native) App is not just to be able to "Tap to start a timer". (or as a "Vanity Project" to say that we know how to write swift @dwyl ...) The beauty "Wearable" is that has sensors that can be used to trigger events! e.g:

While you are "waiting" for the API to be ready ... (promise I'll be back working on API as soon as my current client DevOps work is done!) I thought it would be a good time to start investigating other Apple Watch (WatchKit) APIs!

I know Heart Rate Monitoring might appear to be a "side track" from the "Task Timing" project, But actually tapping into the Heart Rate Monitor gets us to our Goal of Automatic Activity Tracking (without requiring the user to manually start the timer)!

Todo / Tasks

Watch this video: https://youtu.be/CfbvT_vCcwc it's pretty much the "Killer App" for Apple Watch (excuse the terrible pun! but it's a compelling reason to own and give one to a loved one!)

As usual, make sure you ask any relevant questions on GitHub first, then link back to GH from StackOverflow so we continue to keep our knowledge here. (which appears to be pretty active for http://stackoverflow.com/questions/tagged/apple-watch ...)

Relates to: https://github.com/dwyl/sleep/issues/7

sohilpandya commented 7 years ago

@nelsonic ❤️ this and I'll be looking into this very soon (next week 😟), really excited to look into this. 👍

sohilpandya commented 7 years ago

I'd like to spike this whole user story that you've created above, Giving myself a full day to see how far I can get with all the items you've mentioned above.

sohilpandya commented 7 years ago

Investigated Sleep Tracking on this issue https://github.com/dwyl/sleep/issues/8

Healthkit

All health kit data is collected using either the iPhone or Watch, the data collected is stored in an encrypted database called HealthKit store Which can be accessed using HKHealthSrore class.

Both iPhone and the Watch have its own HealthKit store and the data is synced between the two devices. but, old data is removed from the Watch to save space.

Health is a sensitive topic hence Apple provide fine grain control to the user in terms of what information is shareable to the third party app. We would have to specify exactly what data we need from health kit. (heart rate, steps, birthdate, weight, height, sex etc.)

screen shot 2017-07-11 at 12 32 42

Apple states that any app that uses health kit must be primarily designed to provide heath or fitness services and provide a privacy policy.

sohilpandya commented 7 years ago

Nelson asked a question regarding how the data is stored on the iPhone in the first place and how 3rd party apps can access it.

sohilpandya commented 7 years ago

1.5 Days spent on this issue in total. (estimated only 1 day)

nelsonic commented 7 years ago

@sohilpandya did you record a video summary (or our standup where the functionality was discussed) ?

sohilpandya commented 7 years ago

I have the hangout that we recorded on the 11th July, where we walked through the issue as well as the demo app which showed user the total number of steps. https://github.com/dwyl/learn-apple-watch-development/issues/43

nelsonic commented 7 years ago

@sohilpandya sweet! have you uploaded it somewhere?

sohilpandya commented 7 years ago

@nelsonic I've got quite a few of them stored away on the laptop, not anywhere online, I'll get them transferred to our Gdrive folder at some point today. :)

sohilpandya commented 7 years ago

Here is the link https://drive.google.com/drive/u/1/folders/0BzAgO1bmVDtpSU9KZTZEaTdOS00

11th July is on the drive now.

nelsonic commented 7 years ago

@sohilpandya thanks! 🎉