File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
xr/src/main/java/com/example/xr/scenecore Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1616
1717package com.example.xr.scenecore
1818
19+ import android.content.ActivityNotFoundException
1920import android.content.Intent
2021import android.net.Uri
2122import androidx.activity.ComponentActivity
@@ -51,14 +52,18 @@ private fun animateEntity(gltfEntity: GltfModelEntity) {
5152private 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}
You can’t perform that action at this time.
0 commit comments