From 23ca00af3131c609f9b1712921e21fd52e550ad4 Mon Sep 17 00:00:00 2001 From: Dereck Bridie Date: Thu, 22 May 2025 19:58:00 +0200 Subject: [PATCH 1/2] Change SceneViewer intent setup --- .../main/java/com/example/xr/scenecore/GltfEntity.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt b/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt index 586f53fb3..5d7ac84a7 100644 --- a/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt +++ b/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt @@ -51,14 +51,18 @@ private fun animateEntity(gltfEntity: GltfModelEntity) { private fun ComponentActivity.startSceneViewer() { // [START androidxr_scenecore_sceneviewer] val url = - "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/FlightHelmet/glTF/FlightHelmet.gltf" + "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF/Avocado.gltf" val sceneViewerIntent = Intent(Intent.ACTION_VIEW) val intentUri = Uri.parse("https://arvr.google.com/scene-viewer/1.2") .buildUpon() .appendQueryParameter("file", url) .build() - sceneViewerIntent.setDataAndType(intentUri, "model/gltf-binary") - startActivity(sceneViewerIntent) + sceneViewerIntent.setData(intentUri) + try { + startActivity(sceneViewerIntent) + } catch (e: ActivityNotFoundException) { + // There is no activity that could handle the intent. + } // [END androidxr_scenecore_sceneviewer] } From 669445efd44676787ce44fd4791e0ab7ba59e5cd Mon Sep 17 00:00:00 2001 From: Dereck Bridie Date: Thu, 22 May 2025 11:35:17 -0700 Subject: [PATCH 2/2] Update GltfEntity.kt --- xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt b/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt index 5d7ac84a7..c7181e2f3 100644 --- a/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt +++ b/xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt @@ -16,6 +16,7 @@ package com.example.xr.scenecore +import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri import androidx.activity.ComponentActivity