Convert Figma logo to code with AI

google-ar logoarcore-android-sdk

ARCore SDK for Android Studio

4,949
1,215
4,949
386

Top Related Projects

2D skeletal animation runtimes for Spine.

5,373

Image tracking, Location Based AR, Marker tracking. All on the Web.

Quick Overview

The google-ar/arcore-android-sdk repository contains the ARCore SDK for Android, which enables developers to create augmented reality experiences for Android devices. ARCore uses various technologies to integrate virtual content with the real world as seen through a device's camera.

Pros

  • Provides powerful AR capabilities for Android devices
  • Backed by Google, ensuring regular updates and support
  • Offers a wide range of features including motion tracking, environmental understanding, and light estimation
  • Extensive documentation and sample projects available

Cons

  • Limited to Android devices that support ARCore
  • Requires a certain level of expertise in 3D graphics and Android development
  • May have performance issues on lower-end devices
  • Privacy concerns due to the use of camera and sensor data

Code Examples

  1. Initializing ARCore session:
private lateinit var arCoreSession: Session

try {
    if (ArCoreApk.getInstance().requestInstall(this, !installRequested) == ArCoreApk.InstallStatus.INSTALLED) {
        arCoreSession = Session(this)
    }
} catch (e: UnavailableException) {
    // Handle exception
}
  1. Creating an anchor:
val anchor = hitResult.createAnchor()
val anchorNode = AnchorNode(anchor)
anchorNode.setParent(arSceneView.scene)
  1. Adding a 3D model to the scene:
ModelRenderable.builder()
    .setSource(this, R.raw.andy)
    .build()
    .thenAccept { renderable ->
        val node = Node()
        node.renderable = renderable
        anchorNode.addChild(node)
    }

Getting Started

  1. Add ARCore dependency to your app's build.gradle:
dependencies {
    implementation 'com.google.ar:core:1.30.0'
}
  1. Add AR-required permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
  1. Initialize ARCore in your activity:
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    if (ArCoreApk.getInstance().checkAvailability(this) == ArCoreApk.Availability.SUPPORTED_INSTALLED) {
        // ARCore is available and installed
        arCoreSession = Session(this)
    } else {
        // ARCore is not available
    }
}

Competitor Comparisons

2D skeletal animation runtimes for Spine.

Pros of spine-runtimes

  • Cross-platform support for multiple game engines and frameworks
  • Specialized for 2D skeletal animation, offering advanced features
  • Active community and regular updates

Cons of spine-runtimes

  • Focused solely on 2D animation, lacking AR capabilities
  • Requires a separate license for commercial use
  • Steeper learning curve for non-animation specialists

Code Comparison

spine-runtimes (Java):

Skeleton skeleton = new Skeleton(skeletonData);
AnimationState state = new AnimationState(animationStateData);
state.setAnimation(0, "walk", true);
skeleton.updateWorldTransform();

arcore-android-sdk (Java):

Session session = new Session(context);
Anchor anchor = session.createAnchor(pose);
AugmentedImage image = frame.getUpdatedTrackables(AugmentedImage.class).next();
Pose imagePose = image.getCenterPose();

The spine-runtimes code focuses on skeletal animation setup, while arcore-android-sdk deals with AR session management and image tracking. spine-runtimes is more specialized for 2D animation, whereas arcore-android-sdk provides a broader set of AR functionalities for Android development.

5,373

Image tracking, Location Based AR, Marker tracking. All on the Web.

Pros of AR.js

  • Cross-platform compatibility: Works on web browsers, no need for native app installation
  • Simpler setup and implementation for basic AR experiences
  • Lightweight and faster to get started with for web developers

Cons of AR.js

  • Limited advanced features compared to ARCore's native capabilities
  • Less precise tracking and environmental understanding
  • Potentially lower performance for complex AR applications

Code Comparison

AR.js (HTML):

<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
<a-scene embedded arjs>
  <a-marker preset="hiro">
    <a-box position='0 0.5 0' material='color: yellow;'></a-box>
  </a-marker>
  <a-entity camera></a-entity>
</a-scene>

ARCore (Java):

private void createAnchor() {
    Frame frame = fragment.getArSceneView().getArFrame();
    if (frame != null && frame.getCamera().getTrackingState() == TrackingState.TRACKING) {
        Session session = fragment.getArSceneView().getSession();
        Anchor anchor = session.createAnchor(frame.getCamera().getPose());
        AnchorNode anchorNode = new AnchorNode(anchor);
        anchorNode.setParent(fragment.getArSceneView().getScene());
    }
}

The code examples demonstrate the difference in implementation complexity and approach between the two frameworks. AR.js uses a declarative HTML-based setup, while ARCore requires more detailed Java code for creating anchors and managing AR sessions.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ARCore SDK for Android

Copyright 2017 Google LLC

This SDK provides APIs for all of the essential AR features like motion tracking, environmental understanding, and light estimation. With these capabilities you can build entirely new AR experiences or enhance existing apps with AR features.

Breaking change affecting previously published 32-bit-only apps

Google Play Services for AR (ARCore) has removed support for 32-bit-only ARCore-enabled apps running on 64-bit devices. Support for 32-bit apps running on 32-bit devices is unaffected.

If you have published a 32-bit-only (armeabi-v7a) version of your ARCore-enabled app without publishing a corresponding 64-bit (arm64-v8a) version, you must update your app to include 64-bit native libraries. 32-bit-only ARCore-enabled apps that are not updated by this time may crash when attempting to start an augmented reality (AR) session.

To learn more about this breaking change, and for instructions on how to update your app, see https://developers.google.com/ar/64bit.

Quick Start

See the Quickstart for Android Java or Quickstart for Android NDK developer guide.

API Reference

See the ARCore SDK for Java API Reference or ARCore SDK for C API Reference.

Release Notes

The SDK release notes are available on the releases page.

Terms & Conditions

By downloading the ARCore SDK for Android, you agree that the ARCore Additional Terms of Service governs your use thereof.

User privacy requirements

You must disclose the use of Google Play Services for AR (ARCore) and how it collects and processes data, prominently in your application, easily accessible to users. You can do this by adding the following text on your main menu or notice screen: "This application runs on Google Play Services for AR (ARCore), which is provided by Google LLC and governed by the Google Privacy Policy".

See the User privacy requirements.

Deprecation policy

Apps built with ARCore SDK 1.12.0 or higher are covered by the Cloud Anchor API deprecation policy.

Apps built with ARCore SDK 1.11.0 or lower will be unable to host or resolve Cloud Anchors beginning December 2020 due to the SDK's use of an older, deprecated ARCore Cloud Anchor service.