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

AppSystemService Class

Extends VrService
Implements AppSystemCommon , SpatialViewModelOwner
Modifiers: open
AppSystemService serves as the base class for all Spatial SDK services. It contains all Android service lifecycle callbacks: onCreate, 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.

Signature

open class AppSystemService : VrService, AppSystemCommon, SpatialViewModelOwner

Constructors

AppSystemService ()
Signature
constructor()

Properties

componentManager : ComponentManager
[Get]
Signature
val componentManager: ComponentManager
glXFManager : GLXFManager
[Get]
Signature
val glXFManager: GLXFManager
panelRegistrations : HashMap<Int, PanelRegistration>
[Get]
Signature
val panelRegistrations: HashMap<Int, PanelRegistration><Int, PanelRegistration>
registeredReceivers : List
[Get][Set]
Signature
var registeredReceivers: List<List>
scene : Scene
[Get]
Signature
val scene: Scene
systemManager : SystemManager
[Get]
Signature
val systemManager: SystemManager
viewModels : MutableSet
[Get]
Signature
open override val viewModels: MutableSet<SpatialViewModel>

Functions

doFrame ( frameTimeNanos )
Signature
open fun doFrame(frameTimeNanos: Long)
Parameters
frameTimeNanos: Long
findFeature ( clazz )
Signature
fun <T : SpatialFeature> findFeature(clazz: KClass<T>): T
Parameters
clazz: KClass
Returns
VrService
findFeature ()
Signature
inline fun <T : SpatialFeature> findFeature(): T
Returns
VrService
getComponentManager ()
Signature
fun getComponentManager(): ComponentManager
getDataModel ()
Signature
fun getDataModel(): DataModel
Returns
getSceneObject ()
Signature
fun getSceneObject(): Scene
Returns
getSystemManager ()
Signature
fun getSystemManager(): SystemManager
onBind ( intent )
Signature
open fun onBind(intent: Intent): IBinder
Parameters
intent: Intent
Returns
IBinder
onCreate ()
Called when the service 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().
Signature
open override fun onCreate()
onDestroy ()
Called when the service is destroyed. Override this method to perform any final cleanup. If you override this method, be sure to call super.onDestroy()
Note: This is not guaranteed to be called, as the OS may kill the service's hosting process at any time.
Signature
open override fun onDestroy()
onHMDMounted ()
Signature
open fun onHMDMounted()
onHMDUnmounted ()
Signature
open fun onHMDUnmounted()
onRebind ( intent )
Signature
open fun onRebind(intent: Intent)
Parameters
intent: Intent
onRecenter ()
Signature
open fun onRecenter()
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().
Signature
open override fun onSceneReady()
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().
Signature
open override fun onSceneTick()
onStartCommand ( intent , flags , startId )
Signature
open fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int
Parameters
intent: Intent
flags: Int
startId: Int
Returns
Int
onUnbind ( intent )
Signature
open fun onUnbind(intent: Intent): Boolean
Parameters
intent: Intent
Returns
Boolean
onVRPause ()
Signature
open fun onVRPause()
onVRReady ()
Signature
open fun onVRReady()
registerFeatures ()
Signature
open fun registerFeatures(): List<SpatialFeature>
Returns
List
registerMeshCreator ( meshURL , creator )
Signature
open fun registerMeshCreator(meshURL: String, creator: (entity: Entity) -> SceneMesh)
Parameters
meshURL: String
creator: Function1
registerPanel ( panelRegistration )
This is used to register a panel. This is called within the onCreate lifecycle for every PanelRegistration returned by registerPanels. It is strongly discouraged to call this directly to dynamically register panels, as panels should be registered during OnCreate()
Signature
fun registerPanel(panelRegistration: PanelRegistration)
Parameters
panelRegistration: PanelRegistration
registerPanels ()
This hook is where you should register your panels. This is called within the onCreate lifecycle.
Signature
open fun registerPanels(): List<PanelRegistration>
Returns
List
registerSystemFeatures ()
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.
Signature
open override fun registerSystemFeatures(): List<SpatialFeature>
Returns
List
runOnMainThread ( runnable )
Signature
fun runOnMainThread(runnable: Runnable)
Parameters
runnable: Runnable
setBaseHref ( baseHref )
Signature
open fun setBaseHref(baseHref: String)
Parameters
baseHref: String
tryFindFeature ( clazz )
Signature
fun <T : SpatialFeature> tryFindFeature(clazz: KClass<T>): T?
Parameters
clazz: KClass
Returns
VrService?
tryFindFeature ()
Signature
inline fun <T : SpatialFeature> tryFindFeature(): T?
Returns
VrService?
Did you find this page helpful?