API reference
API reference
Select your platform
No SDKs available
No versions available

AppSystemActivity

AppSystemActivity

open class AppSystemActivity : VrActivity, AppSystemCommon
AppSystemActivity serves as the base class for all Spatial activities. It contains all Android activity lifecycle callbacks: onCreate, onStop, onDestroy and others. It also provides scene lifecycle callbacks: onSceneReady and onSceneTick. This class also provides hooks to override system features through registerSystemFeatures and to register panels through registerPanels.

Constructors

NameSummary
AppSystemActivity
constructor()

Types

NameSummary
Companion
object Companion

Properties

NameSummary
componentManager
val componentManager: ComponentManager
glXFManager
val glXFManager: GLXFManager
panelRegistrations
val panelRegistrations: <Error class: unknown class><Int, PanelRegistration>
registeredReceivers
var registeredReceivers: List<<Error class: unknown class>>
scene
var scene: Scene
spatialContext
var spatialContext: SpatialContext
systemManager
val systemManager: SystemManager

Functions

NameSummary
dispatchGenericMotionEvent
open fun dispatchGenericMotionEvent(event: <Error class: unknown class>): Boolean
Dispatches a generic motion event to the appropriate game controller.
dispatchKeyEvent
open fun dispatchKeyEvent(event: <Error class: unknown class>): Boolean
Dispatches a key event to the appropriate game controller.
doFrame
open fun doFrame(frameTimeNanos: Long)
Called when a new display frame is being rendered.
findFeature
inline fun <T : SpatialFeature> findFeature(): T
fun <T : SpatialFeature> findFeature(clazz: KClass<T>): T
getComponentManager
fun getComponentManager(): ComponentManager
Returns the singleton component manager for the application.
getDataModel
fun getDataModel(): DataModel
Returns the singleton DataModel for the application.
getGameControllerDeviceIds
fun getGameControllerDeviceIds(): Set<Int>
Returns a set of device IDs for all connected game controllers.
getSceneObject
fun getSceneObject(): Scene
Returns the singleton scene object for the application.
getSystemManager
fun getSystemManager(): SystemManager
Returns the singleton system manager for the application.
loadLibrary
open fun loadLibrary(name: String)
Loads a native C++ library. This method should be called in onCreate().
onCreate
open override fun onCreate(savedInstanceState: <Error class: unknown class>?)
Called when the activity is first created. Override this lifecycle callback method to do all of your normal static set up: creating views, setting the content view, register Components as well as Systems and etc. You can also perform dynamic setup, such as querying for data and loading it into the view. This will also be called for all activities that are restored to their state when last paused or stopped. If you override this method, be sure to call super.onCreate().
onDestroy
open override fun onDestroy()
Called when the activity is destroyed. Override this method to perform any final cleanup. If you override this method, be sure to call super.onDestroy()
onPause
open fun onPause()
Called as part of the activity lifecycle when an activity is going into the background, but has not yet been killed. The counterpart to onResume(). If you override this method, be sure to call super.onPause().
onPostResume
open fun onPostResume()
Called after activity resume is complete. If you override this method, be sure to call super.onPostResume().
onRecenter
open fun onRecenter()
This hook is called when the VRActivity is recentered.
onResume
open fun onResume()
Called when the activity will start interacting with the user. If you override this method, be sure to call super.onResume()
onSceneReady
open override fun onSceneReady()
This hook is called on the first onResume(), after the scene is loaded in onCreate(). This is where you should call the scene APIs such as setReferenceSpace to define your scene. If you override this method, be sure to call super.onSceneReady().
onSceneTick
open override fun onSceneTick()
Called every tick in the application. It is advisable to use this lifecycle callback method sparingly and to create Systems that manage logic in every tick. If you override this method, be sure to call super.onSceneTick().
onStart
open fun onStart()
Called when the activity is becoming visible to the user. If you override this method, be sure to call super.onStart().
onStop
open fun onStop()
Called when the app is no longer visible to the user. You will next receive either onRestart(), onDestroy(), or nothing, depending on later user activity. If you override this method, be sure to call super.onStop().
onVRPause
open fun onVRPause()
This hook is called when the VRActivity switches from immersive to non-immersive mode. It will invoke all the onVRPause() hooks of the registered SpatialFeatures.
onVRReady
open fun onVRReady()
This hook is called when the immersive Spatial application is first loaded or is changed from 2D mode to immersive (VR) mode. It will invoke all the onVRReady() hooks of the registered SpatialFeatures.
pinGameController
fun pinGameController(deviceId: Int, func: (<Error class: unknown class>?, <Error class: unknown class>?) -> Unit)
Pins a game controller with the given device ID and associates it with the given function.
registerFeatures
open fun registerFeatures(): List<SpatialFeature>
Override this method to register your own SpatialFeatures. This is called in onCreate().
registerMeshCreator
open fun registerMeshCreator(meshURL: String, creator: (entity: Entity) -> SceneMesh)
registerPanel
fun registerPanel(panelRegistration: PanelRegistration)
registerPanels
open fun registerPanels(): List<PanelRegistration>
This hook is where you should register your panels. This is called within the onCreate lifecycle.
registerRequiredOpenXRExtensions
open fun registerRequiredOpenXRExtensions(): List<String>
registerSystemFeatures
open override fun registerSystemFeatures(): List<SpatialFeature>
This hook is where the application registers SystemFeatures such as ToolkitFeature. This is called within the onCreate lifecycle. Note that to register a custom SpatialFeature, override registerFeatures instead.
runOnMainThread
fun runOnMainThread(runnable: Runnable)
This method provides a way to run a Runnable on the activity’s main thread.
setBaseHref
open fun setBaseHref(baseHref: String)
Sets the base href for the application.
tryFindFeature
inline fun <T : SpatialFeature> tryFindFeature(): T?
fun <T : SpatialFeature> tryFindFeature(clazz: KClass<T>): T?
unpinGameController
fun unpinGameController(deviceId: Int)
Unpins a game controller with the given device ID.
useVolumes
open fun useVolumes(): Boolean

Companion

object Companion
Did you find this page helpful?
Thumbs up icon
Thumbs down icon