結論:
(1)iOS 可以利用HealthKit讀取iOS手機中已經記錄的記步數據;
(2)使用后臺GPS定位功能可以獲取每次GPS位置變更后的坐標,使用坐標數據,可以畫出運動軌跡;
(3)結合GPS運動軌跡和記步步數,可以統計出運動量、運動路線;
===關于記步:===
iOS利用HealthKit框架從健康app中獲取步數信息
http://www.cnblogs.com/luoxiaofu/p/5259320.html
read stepCount from health app
這是一個簡單的示例如何利用healthKit框架從健康app中獲取到步數信息
https://github.com/wl356485255/ReadStepCount
官方文檔:
The HealthKit Framework
HealthKit框架指南(The HealthKit Framework的中文版)
http://blog.csdn.net/pjk1129/article/details/41678099
Fit: Store and Retrieve HealthKit Data
https://developer.apple.com/library/ios/samplecode/Fit/Introduction/Intro.html
===關于后臺記錄GPS位置:===
Moves 是如何做到 iOS 后臺數據記錄的?
https://www.zhihu.com/question/21869458/answer/19572145
官方文檔:
參見:#Tracking the User’s Location
The significant-change location service is highly recommended for apps that do not need high-precision location data. With this service, location updates are generated only when the user’s location changes significantly; thus, it is ideal for social apps or apps that provide the user with noncritical, location-relevant information. If the app is suspended when an update occurs, the system wakes it up in the background to handle the update. If the app starts this service and is then terminated, the system relaunches the app automatically when a new location becomes available. This service is available in iOS 4 and later, and it is available only on devices that contain a cellular radio.
簡單的說,iOS 提供三種追蹤地理位置的模式:
<li>地理位置顯著改變服務(推薦)
<li>前臺地理位置服務
<li>后臺地理位置服務