Sandeep Satpute
Posted on April 7, 2024
Introduction
In this post, I would like to introduce a simple way to display 3D models supported by native Android. However. 3D models can be displayed in AR in a variety of ways. Using Scene Viewer with intents directly from your Android native app is one of those methods. In this topic will see how we can display the model using Explicit Intent and Scene viewer.
Using Scene Viewer
Scene Viewer is an immersive viewer that enables 3D and AR experiences from your website or Android app. It lets users of Android mobile devices easily preview, place, view, and interact with web-hosted 3D models in their environment.
Launch Scene Viewer Using an Explicit Intent to Google Play Services for AR
Google Play Services for AR is used to power the AR functionality in Scene Viewer.
You can use an explicit Android intent from a website or native Android app to launch Scene Viewer via the com.google.ar.core package and supply a browser fallback URL to ensure that AR is supported in Scene Viewer. Using Scene Viewer, you can ensure that every user either has a native AR experience or a fallback experience you have created yourself. You may create a gracious error message or your 3D viewer as examples of fallback experiences.
Scene Viewer Using an Explicit Intent Example
val sceneViewerIntent = Intent(Intent.ACTION_VIEW)
val intentUri =
Uri.parse("https://arvr.google.com/scene-viewer/1.0").buildUpon()
.appendQueryParameter("file", "https://storage.googleapis.com/ar-answers-in-search-models/static/Tiger/model.glb") //Working
.appendQueryParameter("mode", "ar_only")
.appendQueryParameter("title", "Tiger")
.build()
sceneViewerIntent.data = intentUri
sceneViewerIntent.setPackage("com.google.ar.core")
sceneViewerIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(sceneViewerIntent)
Github Link
https://github.com/SandeepSatpute9271/Simple_AR
Posted on April 7, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.