The Session provides the primary interface to spatialized functionality
for your app. Each spatialized Activity must create and hold an instance of
Session. After your app creates a session, it can use the Session interfaces
to create spatialized content entities such as panels or 3d models, as well as
set a spatial environment, identify user position, and anchor
content to the real world.
Access a session from Jetpack Compose for XR
When using Jetpack Compose for XR, the session is created for you and can be
accessed using LocalSession.current. See the following example:
If you're creating spatialized entities from the Jetpack SceneCore library,
you'll need to create a session.
To create a session, pass an activity to the create()
method, as shown in the following example:
when(valresult=Session.create(this)){isSessionCreateSuccess->{valxrSession=result.session// ...}else->
TODO(/* A different unhandled exception was thrown. */)}
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-12-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-12-08 UTC."],[],[]]