Code Examples of CMHeadphoneMotionManager in CoreMotion.
- Xcode: 12.0+
- iOS : 14.0+
- iPhone, iPad (*1)
- AirPods Pro / AirPods Max(*2)
*1: iPod Touch (7th generation) is not supported.
*2: The necessary sensors are included, so it should work.
Open AirPodsProMotion.xcodeproj
on Xcode12 or later, then connect your iPhone or iPad to build it.
Infomation View | Rotate the Cube By Head Motion |
Table scrolling By Head Motion |
Export motion data to CSV |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
-
infomation View
Displays the information (CMDeviceMotion
) obtained from AirPodsPro. -
Rotate the Cube By Head Motion
The cube rotates in sync with the orientation of the face. -
Tabel scrolling By Head Motion
Move the face up and down to scroll the TableView.
We don't use any hands at all. -
Export motion data to CSV
Export the motion data acquired from AirpodsPro as a CSV file.
You can check the data by using afile App
.
For more information, a CSV file is stored in the 'Files App > On My iPhone > AirPodsPro' directory.
Yoshio Tsukuda