Table of Contents
The native-code HeadTracking API is composed of one prebuilt static library named
libheadtracking_client.a and 4 C++ header files:
In order to integrate with the native-code HeadTracking API from a standard native app, you simply need to declare a
LOCAL_STATIC_LIBRARIES dependency on
libheadtracking_client.a within your Android.mk file. This is achieved by first defining the HeadTracking library as a
PREBUILT_STATIC_LIBRARY module and setting up a dependency on that module from your module.
The following is an example:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := YourModuleName LOCAL_SRC_FILES := YourSourceFile.cpp LOCAL_LDLIBS := -llog -landroid LOCAL_STATIC_LIBRARIES := libheadtracking_client include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libheadtracking_client LOCAL_SRC_FILES := PathToLibrary/libheadtracking_client.a include $(PREBUILT_STATIC_LIBRARY)
You can then reference the classes and methods declared in the header files from within your sources and build the native component of your app by using the NDK-build utility.
For a fully working example, see the
NativeHeadTrackingSample sample app.
The NativeHeadTrackingSample Sample App
NativeHeadTrackingSample is a native-code sample app for the Fire phone that illustrates the native-code HeadTracking API and its correct usage. The sample includes the following files:
To build and run the sample, ensure that your development environment is set up as described in Setting Up Your Development Environment. You also need to download and install the Android NDK for your platform, available from Android NDK. Then perform the following steps to build and run the sample.
- In a terminal, navigate to
- Copy the
- Build the native component:
- Build and install the app using Gradle:
For UNIX or OSX,
> ./gradlew installDebug
> gradlew.bat installDebug
Native-Code HeadTracking API Reference Documentation
For the reference documentation for the HeadTracking API, see Native HeadTracking API for Fire Phone.