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 16
16
17
17
package com.example.xr.scenecore
18
18
19
+ import android.content.ActivityNotFoundException
19
20
import android.content.Intent
20
21
import android.net.Uri
21
22
import androidx.activity.ComponentActivity
@@ -51,14 +52,18 @@ private fun animateEntity(gltfEntity: GltfModelEntity) {
51
52
private fun ComponentActivity.startSceneViewer () {
52
53
// [START androidxr_scenecore_sceneviewer]
53
54
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"
55
56
val sceneViewerIntent = Intent (Intent .ACTION_VIEW )
56
57
val intentUri =
57
58
Uri .parse(" https://arvr.google.com/scene-viewer/1.2" )
58
59
.buildUpon()
59
60
.appendQueryParameter(" file" , url)
60
61
.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
+ }
63
68
// [END androidxr_scenecore_sceneviewer]
64
69
}
You can’t perform that action at this time.
0 commit comments