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..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 @@ -51,14 +52,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] }