Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions xr/src/main/java/com/example/xr/scenecore/GltfEntity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
}