Reference
Titanium Module Reference
This document describes all available Titanium bindings that exist in the Wikitude Titanium Module.
NOTE: All the following code snippets assume that there is a variable called wikitude
that was created using the following line of code.
var wikitude = require('com.wikitude.ti');
Functions
Managing the ARchitectView
isDeviceSupported
Use this function to check if the current device is capable of running ARchitect Worlds.
@param {string} augmentedRealityMode: Refines the type of ARchitect Worlds that should be loaded. Possible values are: 'IR', 'Geo' & 'IrAndGeo'
@return {bool} true if the device is supported, false otherwise
Usage:
wikitude.isDeviceSupported('IrAndGeo');
createWikitudeView
Use this function to create a new instance of the Wikitude Titanium Module.
@param {string} licenseKey: The Wikitude SDK license key that you received with the purchase of the Wikitude SDK.
@param {string} augmentedRealityMode (iOS only): Refines the type of ARchitect Worlds that should be loaded. Possible values are: 'IR', 'Geo' and 'IrAndGeo'
@return {object} a new instance of the Wikitude Titanium Module
Usage:
var arView = wikitude.createWikitudeView({
"licenseKey": "kDc867UKvVb4YuftUQio+qnZAWWyXBy6s...",
"augmentedRealityMode": 'IrAndGeo',
bottom: 0,
left: 0,
right: 0,
top: 0
});
loadArchitectWorldFromURL
Use this function to load Architect World from either the web or the application bundle.
@param {string} URL: The URL where the Architect World is located. This can either be a relative local path, or the URL to a remote resource.
Usage:
arView.loadArchitectWorldFromURL(URL);
callJavaScript
Use this function to call javascript which will be evaluated in the context of the currently loaded ARchitect World.
@param {string} javascript: The JavaScript that should be evaluated in the ARchitect World context.
Usage:
arView.callJavaScript('alert(\'Hello!\');');
injectLocation
Use this function to inject a location into the Wikitude SDK. The latitude and longitude of the location are in decimal degrees, whereas altitude and accuracy are in meters. The coordinate system used is WGS 84.
@param {object} location: a object that contains each value separately. Valid value names are: 'latitude', 'longitude', 'altitude', 'accuracy'
Usage:
arView.injectLocation({
"latitude": 47.22234,
"longitude": -18.77464,
"altitude": 250,
"accuracy": 10
});
captureScreen
Use this function to generate a screenshot from the current Wikitude SDK view.
@param {bool} includeWebView: Indicates if the ARchitect web view should be included in the generated screenshot or not.
@param {string} imagePathInBundleorNullForPhotoLibrary: If a file path or file name is given, the generated screenshot will be saved in the application bundle. Passing null will save the photo in the device photo library.
@param {function} onSuccess: A function that is called when the screen could be successfully captured. The bundle path is passed to the function when the photo was saved into the application bundle.
@param {function} onError: A function that is called when an error occurred during screen capturing.
Usage:
arView.captureScreen(includeWebView, "/Path/In/Bundle/toImage.png", {
onSuccess: function(path) {
alert('success: ' + path);
},
onError: function(errorDescription) {
alert('error: ' + errorDescription);
}
});
Properties
cullingDistance
Use this property to change the culling distance that is used by the Wikitude SDK. The value of the culling distance is in meter. The default value is 50 kilometer.
Usage:
arView.cullingDistance = 10000;
alert(arView.cullingDistance);
Event Listener
WORLD_IS_LOADED
Use this event listener to get notified when the ARchitect World is loaded or failed to load.
NOTE: Currently Android only supports the failure case.
Usage:
arView.addEventListener('WORLD_IS_LOADED', function(event){
if (true === event.result) {
alert('world loaded');
} else {
alert('error loading ARchitect World: ' + event.error);
}
});
JSON_OBJECT_RECEIVED
Use this event listener to get notified when a call to AR.platform.sendJSONObject
is made inside the ARchitect World.
Usage:
arView.addEventListener('JSON_OBJECT_RECEIVED', function(event){
alert('json object received: ' + event.jsonObject);
});
JavaScript API
Go to JavaScript API Reference for a complete reference of all JavaScript API objects and functions.
Cloud Recognition Manager API
Go to REST API Reference for a complete reference of all REST API calls for the Manager API.