Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the heart rate and the physical activity data from HealthKit in background mode?

I'm working on a app that needs the user's heart rate and physical activity data every hour or so from HealthKit and analyse it and notify the user of a high heart rate streak, all this has to happen when the app is not opened and running (when the app is terminated).

I would like to know if this is possible and how can I access those values? How can I run the code in background mode?

Thanks in advance.

like image 896
Prithiv Dev Avatar asked Nov 01 '22 00:11

Prithiv Dev


1 Answers

Apps on watchOS 2.0 cannot run while in the background. Your app must be foregrounded in order to query for the user's heart rate from HealthKit.

like image 75
Allan Avatar answered Jan 04 '23 14:01

Allan