Skip to content

Latest commit

 

History

History
 
 

AugmentedReality

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

ArcGISARView

guide doc world-scale sample Tabletop sample Flyover sample

Augmented reality experiences are designed to "augment" the physical world with virtual content that respects real world scale, position, and orientation of a device. In the case of Runtime, a SceneView displays 3D geographic data as virtual content on top of a camera feed which represents the real, physical world.

The Augmented Reality (AR) toolkit component allows quick and easy integration of AR into your application for a wide variety of scenarios. The toolkit recognizes the following common patterns for AR:

  • Flyover - Flyover AR allows you to explore a scene using your device as a window into the virtual world. A typical flyover AR scenario will start with the scene’s virtual camera positioned over an area of interest. You can walk around and reorient the device to focus on specific content in the scene. A working flyover app is also available.

  • Tabletop - Scene content is anchored to a physical surface, as if it were a 3D-printed model. Take a look at our tabletop sample.

    Display scene in tabletop AR App

  • World-scale - Scene content is rendered exactly where it would be in the physical world. A camera feed is shown and GIS content is rendered on top of that feed. This is used in scenarios ranging from viewing hidden infrastructure to displaying waypoints for navigation. Look at our example navigation app.

The AR toolkit component is comprised of one class: ArcGISARView. This is a subclass of FrameLayout that contains the functionality needed to display an AR experience in your application. It uses ARCore, Google's augmented reality framework to display the live camera feed and handle real world tracking and synchronization with the Runtime SDK's SceneView. The ArcGISARView is responsible for starting and managing an ARCore session. It uses a user-provided LocationDataSource for getting an initial GPS location and when continuous GPS tracking is required.

Features

  • Allows display of the live camera feed
  • Manages ARCore Session lifecycle
  • Tracks user location and device orientation through a combination of ARCore and the device GPS
  • Provides access to an SceneView to display your GIS 3D data over the live camera feed
  • ARScreenToLocation method to convert a screen point to a real-world coordinate

Add ArcGISARView to your app

NOTE: This assumes you've already added the toolkit to your app, either with Gradle or by following the setup instructions.

  1. Add ArcGISARView to your layout:

    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
    <com.esri.arcgisruntime.toolkit.ar.ArcGISArView
        android:id="@+id/arcGisArView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    
    </android.support.constraint.ConstraintLayout>
  2. Configure lifecycle methods

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_ar_arcgissceneview)
    
        // Register your Activity as the Lifecycle Owner of this View.
        arcGisArView.registerLifecycle(lifecycle)
    }
    
    override fun onResume() {
        super.onResume()
    
        // Create a simple scene.
        arcGisArView.sceneView.scene = ArcGISScene(Basemap.createStreets())
    
        // Set a LocationDataSource, used to get our initial real-world location.
        arcGisArView.locationDataSource = ArLocationDataSource(this)
    
        // Start tracking our location and device orientation and begin the AR Session.
        arcGisArView.startTracking(ArcGISArView.ARLocationTrackingMode.INITIAL)
    }

The required permissions will be merged into your AndroidManifest.xml and are requested at runtime.

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />