Options
All
  • Public
  • Public/Protected
  • All
V1.7
  • V1.6
  • V1.7
Menu

Class BaseApp

Base class for Lumin Runtime apps.

Hierarchy

Index

Constructors

Methods

Constructors

constructor

Methods

addNamed6DOFPoseAction

  • addNamed6DOFPoseAction(a_actionName: string): number
  • Maps Control's 6DoF to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    Returns number

    The Id that can be used to identify this event when received in the eventListener

addNamedButtonAction

  • addNamedButtonAction(a_actionName: string, a_keyCode: KeyCodes, a_longPress?: boolean): number
  • Maps a Control button to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    • a_keyCode: KeyCodes

      The button's key code

    • Optional a_longPress: boolean

      default = false
      Whether the event should be emitted on long press (true) or short press (false)

    Returns number

    The Id that can be used to identify this event when received in the eventListener

addNamedEyeTrackingAction

  • addNamedEyeTrackingAction(a_actionName: string): number
  • Maps eye tracking events to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    Returns number

    The Id that can be used to identify this event when received in the eventListener

addNamedHandGestureAction

  • addNamedHandGestureAction(a_actionName: string, a_handGesture: GestureType, a_hold?: boolean, a_once?: boolean, a_handIndex?: number): number
  • Maps the hand gesture to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    • a_handGesture: GestureType

      Hand gesture type.

    • Optional a_hold: boolean

      default = false
      Whether the event should be sent immediately (true), or send only if the gesture is held for 1.5 seconds (false).

    • Optional a_once: boolean

      default = true
      Whether the event should be repeated (true), or send only once (false).

    • Optional a_handIndex: number

      default = 0xFFFFFFFF
      Hand index that the event should be associated with (Left = 0, Right = 1, Both = 0xFFFFFFFF).

    Returns number

    The Id that can be used to identify this event when received in the eventListener.

addNamedTouchAction

  • Maps a Control gesture to a NamedInputEventData.

    Parameters

    • a_actionName: string

      The name of the NamedInputEventData.

    • a_touchGesture: GestureType

      Touch gesture type.

    • Optional a_touchDirection: GestureDirection

      default = input.GestureDirection.UNKNOWN
      Gesture's direction (GestureDirection::UNKNOWN for all).

    Returns number

    The Id that can be used to identify this event when received in the eventListener

checkPrivilege

deInit

  • deInit(): number
  • Override this method to do one-time de-initialization before quitting.

    priv

    none

    Returns number

deletePrism

  • deletePrism(prism: Prism | null): void

deregisterForConnectionsInviteEvents

  • deregisterForConnectionsInviteEvents(): boolean
  • Deregister this client from receving invites

    Returns boolean

    true if successfully deregistered, false otherwise

dismissAllNotifications

  • dismissAllNotifications(): void
  • Dismss all notifications from this application

    priv

    NormalNotificationsUsage

    Returns void

dismissNotification

  • Dismiss the given notification

    priv

    NormalNotificationsUsage

    Parameters

    Returns boolean

    true if the notification was dismissed, false otherwise

eventListener

  • Override this method to react to incoming events

    Note: This is triggered on the same thread as the clientUpdateThread

    priv

    none

    Parameters

    Returns boolean

    true = Event has been consumed

getComponentName

  • getComponentName(): string
  • Returns the name of the component this application instance belongs to.

    priv

    none

    Returns string

getCurrentLocaleHelper

getFloorHeight

  • getFloorHeight(): number | null
  • Returns the height (y-value) of the floor, if known, in world coordinates.

    priv

    WorldReconstruction

    Returns number | null

    Returned floor height.

getHeadposeConfidence

  • getHeadposeConfidence(): number
  • Get the underlying system's confidence in the headpose values

    Returns number

    a value between 0.0 and 1.0 indicating the confidence

getHeadposeError

  • getHeadposeError(): Error

getHeadposeMode

  • getHeadposeMode(): Mode

getHeadposeWorldForwardVector

  • getHeadposeWorldForwardVector(): [number, number, number]
  • Get the Headpose forward vector in world space.

    Returns [number, number, number]

    the world space headpose forward vector.

getHeadposeWorldPosition

  • getHeadposeWorldPosition(): [number, number, number]
  • Get the Headpose position in world space.

    Returns [number, number, number]

    the world space headpose position.

getHeadposeWorldUpVector

  • getHeadposeWorldUpVector(): [number, number, number]
  • Get the Headpose up vector in world space.

    Returns [number, number, number]

    the world space headpose up vector.

getInput

  • Get the input state tracking system (used to maintain the list of active input devices and track their input)

    Returns InputHelper | null

    a pointer to the input state tracking system

getLocaleCode

  • getLocaleCode(): string | null

getNearestPCF

  • getNearestPCF(worldLocation: [number, number, number] | Float32Array): PCFId
  • Returns the nearest Persistent Coordinate Frame to a given world location. NOTE: This function can be slow, use sparingly.

    priv

    PcfRead

    Parameters

    • worldLocation: [number, number, number] | Float32Array

      Position to get the PCF from.

    Returns PCFId

    The PCF. If it is INVALID_PCF, it is likely the world mesh hasn't been built up enough to create the PCF data, or the app doesn't have the PcfRead privilege set.

getPCFCount

  • getPCFCount(): number
  • Returns the number of Persistent Coordinate Frames the system knows about.

    priv

    PcfRead

    Returns number

    The PCF count.

getPCFData

  • Gets data associated with a given PCF.

    priv

    PcfRead

    Parameters

    • pcf: PCFId

      The PCF to fetch data for.

    Returns PCFData

    PCF data. Check the state value of the returned data to verify that it is good.

getPCFs

  • getPCFs(): Array<PCFId>
  • Returns a list of the Persistent Coordinate Frames the system knows about. It is suggested that this function should only be called when getPCFCount() > 0 and has changed since the previous call.

    priv

    PcfRead

    Returns Array<PCFId>

    PCF list.

getPackageName

  • getPackageName(): string
  • Returns the package name for this application.

    priv

    none

    Returns string

getPackagePath

  • getPackagePath(): string
  • Returns the application's path

    note

    the path will have a trailing / appended to it e.g. /data/local/tmp/

    Returns string

getPreloadedResources

getPrism

  • getPrism(prismId: bigint): Prism | null
  • Returns pointer to the Prism

    priv

    none

    Parameters

    • prismId: bigint

      the Id of the Prism

    Returns Prism | null

    The prism

getPrismPosition

  • getPrismPosition(a_prism: Prism | null): [number, number, number]
  • Returns the position of a volume in world space

    Parameters

    • a_prism: Prism | null

      the prism

    Returns [number, number, number]

    • the prism position

getPrismRotation

  • getPrismRotation(a_prism: Prism | null): [number, number, number, number]
  • Returns the rotation of a volume in world space

    Parameters

    • a_prism: Prism | null

      the prism

    Returns [number, number, number, number]

    • the prism orientation quaternion

getPrismTransform

  • getPrismTransform(a_prism: Prism | null): [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]
  • Returns the transform of a volume in world space

    Parameters

    • a_prism: Prism | null

      the prism

    Returns [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]

    The transform of the Prism in world space

getTempPath

  • getTempPath(): string
  • Returns the application's path for temporary files

    note

    the path will have a trailing / appended to it e.g. /data/local/tmp/

    priv

    none

    Returns string

getVisibleName

  • getVisibleName(): string
  • Returns the user-visible name for this application.

    priv

    none

    Returns string

getWritablePath

  • getWritablePath(): string
  • Returns the application's writable path.

    This folder is accessible to the application when the user has logged in once, even if the device is locked and not in use. An application that needs to write data when running in the background (e.g. a music app) should use this path. The same application can continue using this path when the device is unlocked afterwards.

    note

    the path will have a trailing / appended to it e.g. /data/user/1/apps/com.magicleap.app/documents/C2/

    priv

    none

    Returns string

getWritablePathWhenUnlocked

  • getWritablePathWhenUnlocked(): string
  • Returns the application's writable path while unlocked.

    This folder is accessible to the application when the user has logged in and the device is unlocked and being used.

    note

    the path will have a trailing / appended to it e.g. /data/user/1/apps/com.magicleap.app/documents/C2/

    priv

    none

    Returns string

isImageTrackingReady

  • isImageTrackingReady(): boolean
  • Returns if the image tracking system is ready to be used. Do not call any image tracking functions until this function returns true.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Returns boolean

    true if we can start tracking images.

isInternetConnected

  • isInternetConnected(): boolean
  • Get Internet Connection status. return True if there is a connection, otherwise false.

    Returns boolean

isShareableApp

  • isShareableApp(): boolean
  • Returns if the app running is a Shareable app

    priv

    none

    Returns boolean

isWiFiConnected

  • isWiFiConnected(): boolean
  • Get WiFi Connected status. return True if there is a connection, otherwise false.

    Returns boolean

isWiFiEnabled

  • isWiFiEnabled(): boolean
  • Get WiFi Enabled status. return True if Wifi is enabled in settings, otherwise false.

    Returns boolean

lockCurrentLocaleHelperToLocale

  • lockCurrentLocaleHelperToLocale(localeCode: string): void
  • Lock the LocaleHelper to the given locale. It will no longer change when the system locale is changed

    Parameters

    • localeCode: string

      the lock that the LocaleHelper will be locked to

    Returns void

onAppPause

  • onAppPause(): void
  • The app should backup its data to disk and be prepared to be killed if the system thinks it is necessary. It should also stop drawing to the surface since it will not be rendered.

    priv

    none

    Returns void

onAppResume

  • onAppResume(): void
  • The app can resume drawing to the surface and recover the resources it stashed during onPause()

    priv

    none

    Returns void

onAppStart

  • onAppStart(initArg: InitArg): void
  • Entry point for all application launch requests.

    This method will be called right after init() on first application launch. It will also be called whenever an attempt is made to launch the application again (from launcher menu, or to open a file or URI).

    Parameters

    • initArg: InitArg

      The initial application argument.

    Returns void

onAppUnloadResources

  • onAppUnloadResources(): void
  • The app should release resources that it is not actively using to reduce the load on the system

    priv

    none

    Returns void

onDeviceActive

  • onDeviceActive(): void
  • This indicates to the app that the device has transtioned to the active mode

    priv

    none

    Returns void

onDeviceReality

  • onDeviceReality(): void
  • This indicates to the app that the device has transitioned to the reality mode

    priv

    none

    Returns void

onDeviceStandby

  • onDeviceStandby(): void
  • This indicates to the app that the device has transitioned to the standby mode

    priv

    none

    Returns void

onSharingStart

  • onSharingStart(sessionId: bigint, sceneGraphIDs: Array<bigint>): void
  • Override this method to receive sharing start callback

    Parameters

    • sessionId: bigint

      Id associated with the sharing session that has just started

    • sceneGraphIDs: Array<bigint>

      Vector of SceneGraphIDs that are associated with an ongoing session

    Returns void

onSharingStop

  • onSharingStop(sessionId: bigint): void
  • Override this method to receive sharing stop callback

    Parameters

    • sessionId: bigint

      Id associated with the sharing session that has just stopped

    Returns void

orientPrism

  • orientPrism(a_prism: Prism | null, a_orientation: [number, number, number, number] | Float32Array): void
  • Sets the Orientation of the Prism

    Parameters

    • a_prism: Prism | null

      the prism

    • a_orientation: [number, number, number, number] | Float32Array

      the new prism orientation quaternion

    Returns void

orientPrismRelativeToCamera

  • orientPrismRelativeToCamera(a_prism: Prism | null, a_orientation: [number, number, number, number] | Float32Array): void
  • Sets the Orientation of the Prism relative to the Camera

    Parameters

    • a_prism: Prism | null

      the prism

    • a_orientation: [number, number, number, number] | Float32Array

      the new prism orientation quaternion

    Returns void

positionPrism

  • positionPrism(a_prism: Prism | null, a_position: [number, number, number] | Float32Array): void
  • Sets the Prism Position

    Parameters

    • a_prism: Prism | null

      the prism

    • a_position: [number, number, number] | Float32Array

      the new prism position

    Returns void

positionPrismRelativeToCamera

  • positionPrismRelativeToCamera(a_prism: Prism | null, a_position: [number, number, number] | Float32Array): void
  • Sets the Prism Position relative to the camera

    Parameters

    • a_prism: Prism | null

      the prism

    • a_position: [number, number, number] | Float32Array

      the new prism position, relative to the camera

    Returns void

postNotification

  • postNotification(notification: Notification | null): boolean
  • Post the given notification

    priv

    NormalNotificationsUsage

    Parameters

    • notification: Notification | null

      the notification to post

    Returns boolean

    true if the notification was posted successfully, false otherwise

quit

  • quit(): void
  • The application will terminate on the next update loop when this is called.

    priv

    none

    Returns void

raycastNodes

  • raycastNodes(a_prism: Prism | null, a_rayStart: [number, number, number] | Float32Array, a_rayEnd: [number, number, number] | Float32Array): RayCastResultLight | null
  • Do a raycast in a prism and return the results.

    Parameters

    • a_prism: Prism | null

      Prism to do the ray in.

    • a_rayStart: [number, number, number] | Float32Array

      Ray starting position, in volume coordinates.

    • a_rayEnd: [number, number, number] | Float32Array

      Ray end position, in volume coordinates.

    Returns RayCastResultLight | null

    Hit data.

registerForConnectionsInviteEvents

  • registerForConnectionsInviteEvents(): boolean
  • Register this client to receive invites

    Returns boolean

    true if successfully registered, false otherwise

registerOnLocaleChangedCallback

  • registerOnLocaleChangedCallback(callbackFunction: ((arg0: string) => void) | null): CallbackID
  • Register a callback for when the system locale is changed

    Parameters

    • callbackFunction: ((arg0: string) => void) | null

      the function to be called (the new locale code is given as a parameter)

    Returns CallbackID

    the internal ID of the callback, can be used to unregister the callback

requestPrivilege

  • Asynchronously requests a privilege.

    The result will be returned on the main thread as a PrivilegeEvent.

    priv

    none

    Parameters

    Returns void

requestPrivilegeBlocking

requestWorldPlaneCast

  • requestWorldPlaneCast(center: [number, number, number] | Float32Array, maxDistance: number, maxPlaneCount: number, flags: PlanecastFlags, userValue: bigint): boolean
  • Sends a request to the server to search for planes in the environment that match given criteria. A WorldPlaneCastEventData instance will be sent to the app's eventListener function when the data is ready.

    priv

    WorldReconstruction

    Parameters

    • center: [number, number, number] | Float32Array

      Position in world-space that is the center of the search space.

    • maxDistance: number

      Max distance from the center to search for planes.

    • maxPlaneCount: number

      Maximum number of planes to return.

    • flags: PlanecastFlags

      Flags to determine what kind of planes to look for.

    • userValue: bigint

      Value that will be sent back in the WorldPlaneCastEventData instance.

    Returns boolean

    true if the request was sent, false on error

requestWorldRayCast

  • requestWorldRayCast(rayStart: [number, number, number] | Float32Array, rayDir: [number, number, number] | Float32Array, userValue: bigint, confidenceThreshold?: number): boolean
  • requestWorldRayCast(rayStart: [number, number, number] | Float32Array, rayDir: [number, number, number] | Float32Array, width: number, height: number, horizFovDeg: number, userValue: bigint, confidenceThreshold?: number): boolean
  • Performs a single ray cast against the world around you. Results are returned as a WorldRayCastEventData to the app's eventListener function.

    priv

    WorldReconstruction

    Parameters

    • rayStart: [number, number, number] | Float32Array

      The start point of the ray, in world space.

    • rayDir: [number, number, number] | Float32Array

      Direction to shoot the ray

    • userValue: bigint

      Custom data that you wish to record with this request

    • Optional confidenceThreshold: number

      default = 0.199
      Confidence level (between 0 and 1) that must be reached for the raycast to be considered valid

    Returns boolean

    true if the request was sent, false on error

  • Performs an area ray cast against the world around you. Results are returned as a WorldRayCastEventData to the app's eventListener function.

    priv

    WorldReconstruction

    Parameters

    • rayStart: [number, number, number] | Float32Array

      The start point of the ray, in world space.

    • rayDir: [number, number, number] | Float32Array

      Direction to shoot the ray

    • width: number

      Number of horizontal rays

    • height: number

      Number of vertical rays

    • horizFovDeg: number

      Horizontal field-of-view, in degrees

    • userValue: bigint

      Custom data that you wish to record with this request

    • Optional confidenceThreshold: number

      default = 0.199
      Confidence level (between 0 and 1) that must be reached for the raycast to be considered valid

    Returns boolean

    true if the request was sent, false on error

resizePrism

  • resizePrism(a_prism: Prism | null, a_size: [number, number, number] | Float32Array): void
  • Resizes the Prism

    Parameters

    • a_prism: Prism | null

      the prism to resize

    • a_size: [number, number, number] | Float32Array

      the new size of the prism

    Returns void

setAudioOutputDeviceChangeCallback

  • setAudioOutputDeviceChangeCallback(callback: ((arg0: AudioOutputDevice) => void) | null): void
  • Sets the callback function to be called when audio output device is changed. Note: The callback will run on main thread. No need to use runOnMainThread() inside the callback.

    Parameters

    • callback: ((arg0: AudioOutputDevice) => void) | null

      std::function to be called as callback. See AudioOutputDeviceChangedCallback.

    Returns void

setEventSleepTime

  • setEventSleepTime(a_fSleepTime: number): void
  • Set the Event Sleep Time

    This is the amount of time the client should sleep before firing the updateloop callback, if no other events have occured.

    priv

    none

    Parameters

    • a_fSleepTime: number

      Time to sleep in seconds, or 0.0f to sleep indefinitely, until an event occurs.

    Returns void

stopTrackImage

  • stopTrackImage(imageName: string): boolean
  • Stops tracking an image. If no images are being tracked, will disable tracking.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Parameters

    • imageName: string

      Name of the image. Should be the same as the name passed to one of the the trackImage functions.

    Returns boolean

    true if tracking the image was stopped

trackMovingImage

  • trackMovingImage(imageName: string, dimensions: [number, number] | Float32Array, file: string, prism: Prism | null): boolean
  • Starts a request to track a moving image, based on an image file. Moving images are harder to track than non-moving ones; use this function only if sure the image is moving. This will enable tracking if it is not already enabled.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Parameters

    • imageName: string

      Unique name for the image.

    • dimensions: [number, number] | Float32Array

      Approximate size of the image, in meters. This is used to help identify the image.

    • file: string

      File name of the image to track. Name is relative to the app's location.

    • prism: Prism | null

      Where to send the image position info

    Returns boolean

    true if tracking was started, false if there was an error.

trackStaticImage

  • trackStaticImage(imageName: string, dimensions: [number, number] | Float32Array, file: string, prism: Prism | null): boolean
  • Starts a request to track an non-moving image, based on an image file. Static images are easier to track than moving ones, so use this method if possible. This will enable tracking if it is not already enabled.

    Currently image tracking is only available for immersive apps.

    priv

    CameraCapture

    Parameters

    • imageName: string

      Unique name for the image.

    • dimensions: [number, number] | Float32Array

      Approximate size of the image, in meters. This is used to help identify the image.

    • file: string

      File name of the image to track. Name is relative to the app's location.

    • prism: Prism | null

      Where to send the image position info

    Returns boolean

    true if tracking was started, false if there was an error.

triggerControlBodyHaptics

  • triggerControlBodyHaptics(pattern: VibePattern, duration?: number, intensity?: VibeIntensity, controlID?: number, deviceID?: number): void
  • Request vibration haptics on the body of the control device

    priv

    none

    Parameters

    • pattern: VibePattern

      the vibration pattern to use

    • Optional duration: number

      default = 100
      the duration to play the pattern over (ms)

    • Optional intensity: VibeIntensity

      default = haptics.VibeIntensity.MEDIUM
      the intensity of the vibration

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlCustomHaptic

  • triggerControlCustomHaptic(haptic: HapticInfo, controlID?: number, deviceID?: number): void
  • Trigger a custom control haptic

    priv

    none

    Parameters

    • haptic: HapticInfo

      and individual custom haptic

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlCustomHaptics

  • triggerControlCustomHaptics(haptics: Array<HapticInfo>, controlID?: number, deviceID?: number): void
  • Trigger a list of custom control haptics

    priv

    none

    Parameters

    • haptics: Array<HapticInfo>

      the combined list of haptics

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlHaptic

  • triggerControlHaptic(haptic: VibePattern, controlID?: number, deviceID?: number): void
  • triggerControlHaptic(haptic: LedPattern, controlID?: number, deviceID?: number): void
  • Trigger a control vibration haptic

    priv

    none

    Parameters

    • haptic: VibePattern

      the VibePattern to trigger

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

  • Trigger a control LED haptic

    priv

    none

    Parameters

    • haptic: LedPattern

      the LedPattern to trigger

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

triggerControlLEDHaptics

  • triggerControlLEDHaptics(pattern: LedPattern, duration?: number, intensity?: VibeIntensity, controlID?: number, deviceID?: number): void
  • Request light haptics on the LEDs of the control device

    priv

    none

    Parameters

    • pattern: LedPattern

      the LED light pattern to use

    • Optional duration: number

      default = 100
      the duration to play the pattern over (ms)

    • Optional intensity: VibeIntensity

      default = haptics.VibeIntensity.MEDIUM
      the intensity of the haptic

    • Optional controlID: number

      default = INVALID_CONTROL_ID
      the ID of the control to use (0 will be the primary control)

    • Optional deviceID: number

      default = INVALID_DEVICE_ID
      the internal ID of the device to use (note, this takes precedence over the control ID)

    Returns void

unlockCurrentLocaleHelper

  • unlockCurrentLocaleHelper(): void
  • Unlock the locale of the LocaleHelper. This will set the LocaleHelper back to the current system locale

    Returns void

unregisterOnLocaleChangedCallback

  • unregisterOnLocaleChangedCallback(callbackID: CallbackID): boolean
  • Unregister a callback for when the system locale is changed

    Parameters

    • callbackID: CallbackID

      the ID of the callback to unregister

    Returns boolean

    true if succesfully unregistered, false otherwise

updateLoop

  • updateLoop(a_fDelta: number): boolean
  • Override this method to do things on the Event Update Thread

    priv

    none

    Parameters

    • a_fDelta: number

      Time Delta since last frame

    Returns boolean

    true = continue

waitForTermination

  • waitForTermination(): void
  • This call will block the caller thread until the app has finished running. It must NOT be called from the client update thread or it will assert.

    priv

    none

    Returns void

Generated using TypeDoc