Skip to content

Commit 7f4c676

Browse files
authored
Change XR SceneViewer intent setup (#531)
* Change SceneViewer intent setup
1 parent 8f703cc commit 7f4c676

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.example.xr.scenecore
1818

19+
import android.content.ActivityNotFoundException
1920
import android.content.Intent
2021
import android.net.Uri
2122
import androidx.activity.ComponentActivity
@@ -51,14 +52,18 @@ private fun animateEntity(gltfEntity: GltfModelEntity) {
5152
private fun ComponentActivity.startSceneViewer() {
5253
// [START androidxr_scenecore_sceneviewer]
5354
val url =
54-
"https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/FlightHelmet/glTF/FlightHelmet.gltf"
55+
"https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF/Avocado.gltf"
5556
val sceneViewerIntent = Intent(Intent.ACTION_VIEW)
5657
val intentUri =
5758
Uri.parse("https://arvr.google.com/scene-viewer/1.2")
5859
.buildUpon()
5960
.appendQueryParameter("file", url)
6061
.build()
61-
sceneViewerIntent.setDataAndType(intentUri, "model/gltf-binary")
62-
startActivity(sceneViewerIntent)
62+
sceneViewerIntent.setData(intentUri)
63+
try {
64+
startActivity(sceneViewerIntent)
65+
} catch (e: ActivityNotFoundException) {
66+
// There is no activity that could handle the intent.
67+
}
6368
// [END androidxr_scenecore_sceneviewer]
6469
}

0 commit comments

Comments
 (0)