C++ Java Unity
Java Reference
Vuforia Class Reference

Classes

interface  UpdateCallbackInterface
 UpdateCallback interface. More...
 

Static Public Member Functions

static void setInitParameters (Activity activity, int flags, String licenseKey)
 
static boolean setDriverLibrary (String libraryName)
 
static int init ()
 Initialize Vuforia. More...
 
static boolean isInitialized ()
 Checks whether Vuforia has been already successfully initialized. More...
 
static void deinit ()
 Deinitialize Vuforia. More...
 
static int setAllowedFusionProviders (int providerTypes)
 Specify which providers Vuforia Fusion is allowed to select from. More...
 
static int getActiveFusionProvider ()
 Get the Fusion provider that Vuforia has selected to use. More...
 
static boolean setHint (long hint, int value)
 Set a configuration hint for the Vuforia SDK. More...
 
static void registerCallback (UpdateCallbackInterface object)
 Registers an UpdateCallback instance to be notified when Vuforia is updated. More...
 
static boolean setFrameFormat (int format, boolean enabled)
 Enable or disable specific pixel formats for the Frame returned by State::getFrame(). More...
 
static int getBitsPerPixel (int format)
 Get the number of bits required to store a single pixel in the given format. More...
 
static boolean requiresAlpha ()
 Get whether the rendering surface should be configured with an alpha channel. More...
 
static int getBufferSize (int width, int height, int format)
 Get the number of bytes required for a particular image buffer. More...
 
static void onResume ()
 Execute Vuforia-specific lifecycle management tasks when the app is resumed. More...
 
static void onPause ()
 Execute Vuforia-specific lifecycle management tasks when the app is paused. More...
 
static void onSurfaceCreated ()
 Inform Vuforia that the rendering surface has been created. More...
 
static void onSurfaceChanged (int width, int height)
 Inform Vuforia about the size of the rendering surface, or that its size has changed. More...
 
static String getLibraryVersion ()
 Get the version of the Vuforia SDK as a C-style string. More...
 

Static Public Attributes

static final int GL_20 = 1
 OpenGL ES 2.0 init flag. DEPRECATED, please use INIT_FLAGS.GL_20. More...
 
static final int GL_30 = 8
 OpenGL ES 3.0 init flag. DEPRECATED, please use INIT_FLAGS.GL_30. More...
 
static final int INIT_ERROR = -1
 Error during initialization. DEPRECATED, please use INIT_ERRORCODE.INIT_ERROR. More...
 
static final int INIT_DEVICE_NOT_SUPPORTED = -2
 The device is not supported. DEPRECATED, please use INIT_ERRORCODE.INIT_DEVICE_NOT_SUPPORTED. More...
 
static final int INIT_NO_CAMERA_ACCESS = -3
 Cannot access the camera. DEPRECATED, please use INIT_ERRORCODE.INIT_NO_CAMERA_ACCESS. More...
 
static final int INIT_LICENSE_ERROR_MISSING_KEY = -4
 License key is missing. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_MISSING_KEY. More...
 
static final int INIT_LICENSE_ERROR_INVALID_KEY = -5
 Invalid license key passed to SDK. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_INVALID_KEY. More...
 
static final int INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT = -6
 Unable to verify license key due to network (permanent error). DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT. More...
 
static final int INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT = -7
 Unable to verify license key due to network (transient error). DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT. More...
 
static final int INIT_LICENSE_ERROR_CANCELED_KEY = -8
 Provided key is no longer valid. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_CANCELED_KEY. More...
 
static final int INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH = -9
 Provided key is not valid for this product. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH. More...
 
static final int INIT_EXTERNAL_DEVICE_NOT_DETECTED = -10
 Dependent external device not detected/plugged in. DEPRECATED, please use INIT_ERRORCODE.GL_20. More...
 

Member Function Documentation

static void setInitParameters ( Activity  activity,
int  flags,
String  licenseKey 
)
static
static boolean setDriverLibrary ( String  libraryName)
static
static int init ( )
static

Initialize Vuforia.

See also
The reference documentation homepage has more general information aboutVuforia's app lifecycle.

This function makes all the other systems in Vuforia available for use. It should always be the second function that you call (setInitParameters() being the first).

This function should be called in a loop, ideally on a background thread, until it returns either an integer >= 100 or an error code (<0). The background thread is critical on platforms that require user approval to access camera hardware (such as iOS or Android), as the approval process typically requires that the main/UI thread is not blocked.

runOnBackgroundThread({
int initResult = 0;
while (initResult = 0 initResult 100) {
initResult = Vuforia::init();
}
if (initResult 0) {
... handle error
} else {
... continue initialization
...
}
})
Returns
A number representing either a progress toward completion (0..100) or an error code (<0, see #::INIT_ERRORCODE).
static boolean isInitialized ( )
static

Checks whether Vuforia has been already successfully initialized.

static void deinit ( )
static

Deinitialize Vuforia.

See init() for an overview of the full app lifecycle.

static int setAllowedFusionProviders ( int  providerTypes)
static

Specify which providers Vuforia Fusion is allowed to select from.

Vuforia Fusion is a feature, introduced with Vuforia 7, that is designed to provide the best possible AR experience on a wide range of devices. Fusion solves the problem of fragmentation in AR-enabling technologies, including cameras, sensors, chipsets, and software frameworks such as ARKit, ARCore and Windows Holographic. It fuses the capabilities of the underlying device with Vuforia features, allowing developers to rely on a single Vuforia API for an optimal AR experience across multiple devices and platforms.

This method provides advanced developers with a way to control which technologies Fusion will use.

Before you pass anything other than FUSION_PROVIDER_ALL, you should have a solid understanding of

  • the functionality offered by the underlying platforms,
  • the technology involved in enabling AR, and
  • the robustness of the various options.

If you restrict Fusion to FUSION_PROVIDER_VUFORIA_VISION_ONLY, Ground Plane will cease to work and ModelTargets will operate in a less robust manner.

Not all Fusion providers are available on all platforms. If none of the allowed Fusion providers are available, FUSION_PROVIDER_VUFORIA_VISION_ONLY will be used as a fallback (even if it is not passed to setAllowedFusionProviders()). Use getActiveFusionProvider() (after Vuforia::init() has succeeded) to find out which Fusion provider is actually in use.

Note: This function must be called before Vuforia::init() if the provider to be changed is FUSION_PROVIDER_PLATFORM_SENSOR_FUSION. FUSION_PROVIDER_VUFORIA_SENSOR_FUSION can be modified after initialization when no trackers have been initialized with TrackerManager::initTracker()

Parameters
providerTypesA single value created by OR'ing together the desired FUSION_PROVIDER_TYPE values. Do not pass FUSION_PROVIDER_INVALID_OPERATION.
Returns
the value passed to providerTypes on success, or FUSION_PROVIDER_INVALID_OPERATION on failure or if Vuforia::init() has already been called.
static int getActiveFusionProvider ( )
static

Get the Fusion provider that Vuforia has selected to use.

The active Fusion provider will not change after Vuforia has been initialized.

To selectively enable or disable particular Fusion provider types before initialization, see setAllowedFusionProviders().

Note: This function may only be called after Vuforia::init() has successfully completed.

Returns
The currently used Fusion provider (one of FUSION_PROVIDER_TYPE), or FUSION_PROVIDER_INVALID_OPERATION if Vuforia::init() has not yet been called.
static boolean setHint ( long  hint,
int  value 
)
static

Set a configuration hint for the Vuforia SDK.

Hints help the SDK to understand the developer's needs.

Depending on the device or SDK version, certain hints might be ignored.

Parameters
hintThe hint to set (see HINT for possible values).
valueThe value for the hint. For boolean values, pass 1 for true and 0 for false.a
Returns
true if the hint was set successfully, or false if the hint is unknown or deprecated.
static void registerCallback ( UpdateCallbackInterface  object)
static

Registers an UpdateCallback instance to be notified when Vuforia is updated.

The passed-in object's Vuforia_onUpdate() function will be called with a new State instance as soon as Vuforia finishes processing a new camera frame.

You should only use this callback for time-critical operations on the frame, or to perform operations which need to be synchronized to the camera thread (e.g. activating and deactivating DataSet instances on an ObjectTracker).

You should avoid doing any processor intensive work here. The callback is called on the camera thread, which means that Vuforia's tracking pipeline will be blocked from further execution until the callback returns.

For normal use cases, you should use the pull interface to access State instances as part of your rendering loop. See State and StateUpdater for more information.

Only one callback object can be registered. Calling registerCallback() a second time replaces the existing callback object.

Parameters
objectThe object that should receive update callbacks.
static boolean setFrameFormat ( int  format,
boolean  enabled 
)
static

Enable or disable specific pixel formats for the Frame returned by State::getFrame().

Images in the enabled pixel formats will be available in the list of images returned by Frame::getImages().

By default, the Frame returned by State::getFrame() contains images in whichever pixel formats are required for internal processing. For example, image tracking requires a grayscale image, so if you are doing image tracking the Frame returned by getFrame() will typically include a grayscale image.

If you need a specific format for the frame data (if you are doing your own processing on the image), you can use setFrameFormat() to request this format.

Note: Requesting a specific pixel format may induce additional processing overhead in some cases.

Parameters
formatThe pixel format that you want for frames returned by State::getFrame().
enabledtrue to enable the format, false to disable it.
Returns
true if the pixel format was enabled, false otherwise (check application logs for failure details).
static int getBitsPerPixel ( int  format)
static

Get the number of bits required to store a single pixel in the given format.

Parameters
formatThe format to query.
Returns
The bits per pixel for the given format, or 0 if the format is unknown.
static boolean requiresAlpha ( )
static

Get whether the rendering surface should be configured with an alpha channel.

static int getBufferSize ( int  width,
int  height,
int  format 
)
static

Get the number of bytes required for a particular image buffer.

Parameters
widthThe width of the image, in pixels.
heightThe height of the image, in pixels.
formatThe pixel format that will be used to store the image.
Returns
The number of bytes required for the specified image buffer, or 0 if the format is unknown.
static void onResume ( )
static

Execute Vuforia-specific lifecycle management tasks when the app is resumed.

Note: Only has effect if Vuforia is initialized. See init() for a discussion of the full Vuforia lifecycle.

Call when

  • an application has been started or just come back from the background
  • an application is already active and Vuforia has just been initialized with init()

Executes the following internal tasks:

  • enables rendering
  • applies device-specific internal AR settings (e.g. camera resolution, sensor rate)
  • restarts all motion sensors used by Vuforia if previously running
  • resumes a previously active EyewearDevice (e.g. activates last display mode, starts pose prediction)
static void onPause ( )
static

Execute Vuforia-specific lifecycle management tasks when the app is paused.

Note: Only has effect if Vuforia is initialized. See init() for a discussion of the full Vuforia lifecycle.

Call when

  • an application is about to become inactive (e.g. going to background)
  • an application is still active (won't go to background or be stopped) and Vuforia is about to be deinitialized with deinit()

Executes the following internal tasks:

  • disables rendering
  • stops all currently running motion sensors used by Vuforia
  • pauses an active EyewearDevice (e.g. switches display mode to mono, pauses pose prediction)
static void onSurfaceCreated ( )
static

Inform Vuforia that the rendering surface has been created.

Note: Only has effect if Vuforia is initialized. See init() for a discussion of the full Vuforia lifecycle.

Note: This function must be called on the rendering thread, with any platform- or device-specific rendering context activated.

Note: Calling this function changes the RenderingPrimitives returned by Device::getRenderingPrimitives(). If you have a cached copy of the RenderingPrimitives, you will need to call Device::getRenderingPrimitives() again to get an updated copy.

You should call this function when the rendering surface/context first becomes available.

Executes the following internal tasks:

static void onSurfaceChanged ( int  width,
int  height 
)
static

Inform Vuforia about the size of the rendering surface, or that its size has changed.

You should call this function once after the rendering surface/context has been created for the first time, and again whenever the render surface changes size (e.g. due to you app changing orientation, or a window resize event).

Note: This function must be called on the rendering thread, with any platform- or device-specific rendering context activated. It only has effect if Vuforia is initialized.

Executes the following internal tasks:

  • releases any previously created Vuforia-internal rendering resources.
  • triggers a configuration change in the Vuforia Device that (among other things) enables getRenderingPrimitives() to return valid data for the current rendering surface.

Note: RenderingPrimitives instances obtained via Device::getRenderingPrimitives() will not contain valid data for the current rendering surface unless onSurfaceChanged() has been called first.

static String getLibraryVersion ( )
static

Get the version of the Vuforia SDK as a C-style string.

Member Data Documentation

final int GL_20 = 1
static

OpenGL ES 2.0 init flag. DEPRECATED, please use INIT_FLAGS.GL_20.

final int GL_30 = 8
static

OpenGL ES 3.0 init flag. DEPRECATED, please use INIT_FLAGS.GL_30.

final int INIT_ERROR = -1
static

Error during initialization. DEPRECATED, please use INIT_ERRORCODE.INIT_ERROR.

final int INIT_DEVICE_NOT_SUPPORTED = -2
static

The device is not supported. DEPRECATED, please use INIT_ERRORCODE.INIT_DEVICE_NOT_SUPPORTED.

final int INIT_NO_CAMERA_ACCESS = -3
static

Cannot access the camera. DEPRECATED, please use INIT_ERRORCODE.INIT_NO_CAMERA_ACCESS.

final int INIT_LICENSE_ERROR_MISSING_KEY = -4
static

License key is missing. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_MISSING_KEY.

final int INIT_LICENSE_ERROR_INVALID_KEY = -5
static

Invalid license key passed to SDK. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_INVALID_KEY.

final int INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT = -6
static

Unable to verify license key due to network (permanent error). DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT.

final int INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT = -7
static

Unable to verify license key due to network (transient error). DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT.

final int INIT_LICENSE_ERROR_CANCELED_KEY = -8
static

Provided key is no longer valid. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_CANCELED_KEY.

final int INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH = -9
static

Provided key is not valid for this product. DEPRECATED, please use INIT_ERRORCODE.INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH.

final int INIT_EXTERNAL_DEVICE_NOT_DETECTED = -10
static

Dependent external device not detected/plugged in. DEPRECATED, please use INIT_ERRORCODE.GL_20.