The Inseye SDK provides tools for interacting with the Inseye eye tracking service on Android devices. This document provides en an overview of the SDK's main classes and their functionalities.
To function properly, the Inseye SDK requires the following components to be installed on the device:
- Inseye Android Service
- Inseye Android Service - public version
- Inseye Android Service PRO - for internal and privileged users. Exposes additional settings. Requires access to be granted by Inseye
- Inseye Calibration - depends on target platform
Please ensure these components are installed and running on the device.
Add JitPack repository to your root build.gradle
at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
To use the Inseye SDK in your Android project, add the following dependency to your target module build.gradle
file:
dependencies {
implementation 'com.github.Inseye:Inseye-SDK-Android:TAG'
}
Replace TAG
with latest released version
Alternativly you can also use AAR
libs directly (both are required)
InseyeSDK
is the main entry point for interacting with the Inseye SDK.
public InseyeSDK(Context context)
context
The application context.
public boolean isServiceConnected()
Returns true
if the Inseye service is connected, false
otherwise.
public CompletableFuture<InseyeTracker> getEyeTracker()
Asynchronously retrieves an instance of InseyeTracker. Returns a CompletableFuture
that completes with an InseyeTracker instance when the service is connected, or completes exceptionally if an error occurs.
public void dispose()
Disposes InseyeTracker instance
InseyeTracker
is the main class for interacting with the Inseye eye tracker.
public TrackerAvailability getTrackerAvailability()
Returns the current availability status of the eye tracker.
Available
- eye tracker is connected and ready to start new calibration or streaming gaze dataDisconnected
- eye tracker is disconnected from deviceCalibrating
- eye tracker is in the process of calibrationUnavailable
- eye tracker is connected to device but not yet available for useNotCalibrated
- eye tracker is not calibrated. Device must be calibrated before serving gaze dataUnknown
- the eyetracker is connected but unavailable for unknown reason. his flag should should only appear if client library is behind service library and new flags were added.
public void subscribeToTrackerStatus(IEyetrackerEventListener eventListener)
Subscribes to eye tracker status events.
eventListener
The listener to receive eye tracker status events. It contains callback with TrackerAvailability
public void unsubscribeFromTrackerStatus()
Unsubscribes from eye tracker status events.
public void startStreamingGazeData() throws InseyeTrackerException
Starts streaming gaze data. Throws an InseyeTrackerException if gaze data streaming fails.
public void stopStreamingGazeData()
Stops streaming gaze data. That means IEyetrackerEventListener
stops receiving gaze updates and getMostRecentGazeData()
returns null
public void subscribeToGazeData(@NonNull GazeDataReader.IGazeData gazeDataListener)
Subscribes to gaze data updates. startStreamingGazeData()
must be called before this method.
gazeDataListener
The listener to receive gaze data updates.
public void unsubscribeFromGazeData()
Unsubscribes from gaze data updates.
public GazeData getMostRecentGazeData()
Returns the most recent GazeData
, or null if no gaze data is available. startStreamingGazeData()
must be called before this method.
public CompletableFuture<ActionResult> startCalibration()
Starts the built-in calibration procedure. Returns a CompletableFuture
that completes when the calibration procedure finishes. The result of the future indicates whether the calibration was successful.
public void abortCalibration()
Aborts the ongoing calibration procedure.
public Eye getDominantEye()
Returns the dominant eye of the user. This could be configured by user in Inseye Service
settings ui
Possible eye values:
BOTH
LEFT
RIGHT
public ScreenUtils getScreenUtils()
Returns the screen space converters for the Inseye tracker gaze data.
public Version getServiceVersion()
Returns the version of the Inseye service.
public Version getCalibrationVersion()
Returns the version of the eye tracker caliration app.
public Version getFirmwareVersion()
Returns the version of the eye tracker firmware.
GazeData
represents the gaze data obtained from the eye tracker.
Data is representen in radian angles where (0,0) is located in screen center
For screen space and view conversion form angle use methods from ScreenUtils
in combination with GazeDataExtension
timeMilli
- The timestamp in milliseconds.left_x
- The x-coordinate of the left eye gaze angle.left_y
- The y-coordinate of the left eye gaze angle.right_x
- The x-coordinate of the right eye gaze angle.right_y
- The y-coordinate of the right eye gaze angle.event
- TheEyeTrackerEvent
associated with the gaze data.
EyeTrackerEvent
is an enumeration representing various eye tracker events.
NONE
- No event.BLINK_LEFT
- Blink detected in the left eye.BLINK_RIGHT
- Blink detected in the right eye.BLINK_BOTH
- Blink detected in both eyes.SACCADE
- Rapid movement of the eye between fixation points.HEADSET_MOUNT
- Headset has been mounted.HEADSET_DISMOUNT
- Headset has been dismounted.UNKNOWN
- Unknown event.
For a complete example of how to integrate and use the Inseye SDK, please visit Inseye-Android-SDK-Demo
This repository is part of Inseye Software Development Kit.
By using content of this repository you agree to SDK LICENSE