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

SpatialActivityManager

SpatialActivityManager

object SpatialActivityManager
This object is used to manage the current activity. It is used to get a weak reference to the current activity and execute code on the current activity.
Example of getting a reference to the com.meta.spatial.core.SystemManager or com.meta.spatial.core.SpatialContext via the activity:
SpatialActivityManager.getAppSystemActivity().getSystemManager().findSystem<MySystem>() // Grabs the system manager which provides access to all registered systems.
SpatialActivityManager.getAppSystemActivity().getSceneObject() // Grabs the scene

Properties

NameSummary
currentActivity
var currentActivity: WeakReference<AppSystemActivity>?

The current Spatial activity.

Functions

NameSummary
executeOnAppSystemActivity
fun executeOnAppSystemActivity(runnable: (activity: AppSystemActivity) -> Unit)

This function is used to execute a block of code on the current AppSystemActivity’s main thread. If the current activity has not been set or has been garbage collected, it will throw an exception.
executeOnVrActivity
inline fun <T : AppSystemActivity> executeOnVrActivity(crossinline runnable: (activity: T) -> Unit)

This generic function is used to execute a block of code on the current activity’s main thread. If the current activity has not been set or has been garbage collected, it will do nothing.
getAppSystemActivity
fun getAppSystemActivity(): AppSystemActivity

This function is used to get the current activity. This allows you to specify your activity so that you can access data on it. If the current activity has not been set or has been garbage collected, it will return null. Otherwise, it will return the current activity and cast it to type AppSystemActivity.
getVrActivity
inline fun <T : AppSystemActivity> getVrActivity(): T

This generic function is used to get the current activity. This allows you to specify your activity so that you can access data on it. If the current activity has not been set or has been garbage collected, it will return null.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon