Set up your development environment
Install Android Studio version 3.1 or higher with Android SDK Platform version 7.0 (API level 24) or higher.
You will need to get the ARCore SDK for Android. You can either:
Download the ARCore SDK for Android and extract it.
Clone the repository with the following command:
git clone https://github.com/google-ar/arcore-android-sdk.git
Prepare your device or emulator
You can run AR apps on a supported device or in the Android Emulator. You must update Google Play Services for AR on the emulator before running the app. See Run AR Apps in Android Emulator for more information.
Open the sample project
In Android Studio, open the hello_ar_c sample project in
<ARCore SDK Folder>/samples/hello_ar_c.
The sample project has build dependencies on certain versions of software, such as Gradle and the Android SDK. If the required dependencies are not installed, Android Studio will ask you for permission to download and install them on your machine.
Run the sample
Make sure your Android device is connected to the development machine and click Run in Android Studio.
Android Studio builds your project into a debuggable APK, installs the APK, and then runs the app on your device. For more information, see Build and Run Your App.
As you move your device, the app automatically detects flat surfaces and draws a diamond grid. Tap the grid to place a three-dimensional ARCore pawn on the surface.
Use Instant Placement
The Instant Placement API allows the user to place an AR object on the screen without having to wait for ARCore to detect surface geometry. Object placement is refined in real time as the user moves further around the environment. Once ARCore detects the correct pose in the region where the AR object is placed, the object automatically updates to be pose-accurate. The user will see the holographic object become opaque.
Enable and place a virtual object using Instant Placement
To enable Instant Placement in hello_ar_c, run the app. Tap the gear icon on the screen and choose Instant Placement from the drop-down menu. Select Enable Instant Placement.
Tap on the screen to place an object. Make sure to continue moving the device around after seeing the holographic object appear on screen, so that ARCore can get sufficient data about your surroundings to accurately anchor the virtual object.
- Learn how to Enable ARCore in your app.
- Use Augmented Images to build apps that can respond to 2D images, such as posters or logos, in the user's environment.
- Use Cloud Anchors
- Use the Depth API to ensure accurate depth for realistic and immersive user experiences.
- Use Instant Placement to quickly place AR objects on the screen.
- Review Runtime Considerations.
- Review Design Guidelines.