Fire phone features Dynamic Perspective Sensors, cameras and motion sensors, that work with the software to recognize and track the user’s head. The HeadTracking API gives games and other apps a way to access this head-tracking data. The HeadTracking API provides the data as an event containing the following pieces of information:
- The timestamp of the event.
- Whether the software currently detects the user's face and is actively tracking the user's head.
- The position of the head relative to the screen orientation of the phone, as X, Y, and Z coordinates.
- The angle at which the head is inclined (rotated around the z axis) relative to the screen orientation of the phone.
Note: The content on this page applies to the Java version of the HeadTracking API. To learn about the native-code version of this API, see Understanding the Native-Code HeadTracking API.
Getting Head-Tracking Data
The HeadTracking API offers two ways to obtain head-tracking events, as a listener and by polling. If your app uses head-tracking events as they occur, it can register as a listener and receive head-tracking events as the system makes the information available. If your app requires access to head-tracking data on its own schedule, it creates an empty
HeadTrackingEvent object and passes it to the
HeadTrackingPoller.sample() method to be filled with the latest head-tracking data.
In either case, the app can then extract the head-tracking data from the fields of the
The HeadTracking API also offers the following ways to manage power consumption:
- You can pause head tracking when you are not using it.
- You can choose different fidelity settings for the head tracking data. A lower fidelity implies lower battery consumption.
- You can choose a data filter that uses cameras and motion sensors on the phone to track the head, or you can choose a data filter that uses cameras alone and so uses less power.