संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Session, ऐप्लिकेशन के लिए जगह के हिसाब से फ़ंक्शन के मुख्य इंटरफ़ेस को उपलब्ध कराता है. हर स्पेसलाइज़ की गई गतिविधि के लिए, Session का एक इंस्टेंस बनाना और उसे सेव करना ज़रूरी है. पैनल या 3D मॉडल जैसी स्पेसलाइज़ की गई कॉन्टेंट इकाइयां बनाने के लिए, ऐप्लिकेशन Session इंटरफ़ेस का इस्तेमाल कर सकता है. साथ ही, स्पेशल एनवायरमेंट सेट, उपयोगकर्ता की जगह की पहचान, और असल दुनिया में कॉन्टेंट को ऐंकर करने के लिए भी इसका इस्तेमाल किया जा सकता है.
XR के लिए Jetpack Compose से सेशन ऐक्सेस करना
XR के लिए Jetpack Compose का इस्तेमाल करने पर, आपके लिए सेशन बन जाता है. इसे LocalSession.current का इस्तेमाल करके ऐक्सेस किया जा सकता है. यह उदाहरण देखें:
अगर आपको SceneCore लाइब्रेरी से स्पेसलाइज़ की गई इकाइयां बनानी हैं, तो आपको सेशन बनाना होगा.
सेशन बनाने की सुविधा सिर्फ़ Android XR डिवाइस पर काम करती है. किसी ऐसे डिवाइस पर सेशन बनाने की कोशिश करने पर, सेशन बनाने में समस्या आ सकती है. सेशन बनाने के लिए, create() तरीके में कोई गतिविधि पास करें, जैसा कि यहां दिए गए उदाहरण में दिखाया गया है.
when(valresult=Session.create(this)){isSessionCreateSuccess->{valxrSession=result.session// ...}else->
TODO(/* A different unhandled exception was thrown. */)}
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-08-23 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-08-23 (UTC) को अपडेट किया गया."],[],[],null,["# Session\n\nThe [`Session`](/reference/kotlin/androidx/xr/runtime/Session) provides the primary interface to spatialized functionality\nfor the application. Each spatialized Activity must create and hold an instance\nof `Session`. Once created, the application can use the `Session` interfaces to\ncreate spatialized content entities such as panels or 3d models, as well as [set\na spatial environment](/develop/xr/jetpack-xr-sdk/add-environments), [identify user position](/reference/kotlin/androidx/xr/scenecore/SpatialUser), and [anchor content](/develop/xr/jetpack-xr-sdk/work-with-entities)\nto the real world.\n| **Caution:** Due to a [known issue](/jetpack/androidx/releases/xr-scenecore#1.0.0-alpha04) that ties the session to the Activity lifecycle, the session can become invalid in various situations that automatically recreate the activity. These include, but are not limited to resizing a main panel, connecting peripherals, and changing between light and dark theme. If you run into session invalidation issues, you may need to make your main panel non-resizable, use a dynamic panel entity, disable activity recreation for [specific config changes](/guide/topics/resources/runtime-changes#restrict-activity), or disable light or dark theme changes.\n\nAccess Session from Jetpack Compose for XR\n------------------------------------------\n\nWhen using Jetpack Compose for XR, the session is created for you and can be\naccessed using [`LocalSession.current`](/reference/kotlin/androidx/xr/compose/platform/package-summary#LocalSession()). See the following example:\n\n\n```kotlin\n@Composable\nfun ComposableUsingSession() {\n val session = LocalSession.current\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/xr/src/main/java/com/example/xr/runtime/Session.kt#L26-L29\n```\n\n\u003cbr /\u003e\n\nAccess Session from Jetpack SceneCore\n-------------------------------------\n\nIf you are creating spatialized entities from the SceneCore library, you'll need\nto create the session.\n\nCreating a session is only supported on an Android XR device. Attempting to\ncreate a session on an incompatible device will result in a failed result. To\ncreate a session, pass an activity to the [`create()`](/reference/kotlin/androidx/xr/runtime/Session#create(android.app.Activity,kotlin.coroutines.CoroutineContext)) method, as shown in\nthe following example.\n\n\n```kotlin\nwhen (val result = Session.create(this)) {\n is SessionCreateSuccess -\u003e {\n val xrSession = result.session\n // ...\n }\n else -\u003e\n TODO(/* A different unhandled exception was thrown. */)\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/xr/src/main/java/com/example/xr/runtime/Session.kt#L34-L41\n```\n\n\u003cbr /\u003e\n\n| **Note:** Some features, such as [hand tracking](/develop/xr/jetpack-xr-sdk/arcore/hands) and [plane tracking](/develop/xr/jetpack-xr-sdk/arcore/planes), require additional runtime permissions in order for session configuration to succeed.\n\nWhen a session's activity is destroyed, all spatial UI and 3D content associated\nwith that session is destroyed and the session is no longer valid.\n\nSee also\n--------\n\n- [Check for spatial capabilities](/develop/xr/jetpack-xr-sdk/check-spatial-capabilities)\n- [Transition between HSM and FSM](/develop/xr/jetpack-xr-sdk/transition-home-space-to-full-space)\n- [Add spatial environments to your app](/develop/xr/jetpack-xr-sdk/add-environments)\n- [Add 3D models to your app](/develop/xr/jetpack-xr-sdk/add-3d-models)"]]