Documentation

Android Quickstart

Get started building collaborative augmented reality apps within a few minutes.

The Blue Vision AR Cloud Android SDK is a Unity plugin that works alongside Android ARCore to enable you to place augmented reality content into a single global 3D world, shared amongst all users of your app.

The following guide will help you get started building your first shared Android AR app. For further details, see the Android SDK reference .

1. Download the SDK

The Android Unity SDK is currently accessible through our developer early access program. If you have not done so already, you can sign up here, and we will process your application shortly.

Already have a developer account? Login here to download the latest version of the Android SDK. Follow the instructions to add the SDK to your project.

2. Generate an API key

To use the SDK, you must first generate an API key. Those already signed up to the early access program can do this through the developer’s area.

3. Create an instance of ARCloudSession

The ARCloudSession class is responsible for ensuring your shared AR content is placed correctly in the active scene view. Internally, the class works by keeping track of the position of your device’s camera in the Blue Vision AR Cloud.

In order to use the AR Cloud SDK you need to instantiate prefab from ARCloud/Prefabs/ARCloudDevice.prefab. ARCloud then works whenever this new GameObject is active. You will need to set the API key property of the object, which can be done through the user interface. You must allow access to location services and the camera.

4. Create shared content with ARCloudAnchor

Anchors represent a fixed position (and orientation) in the AR Cloud that can be shared across sessions and devices. Every anchor that you create is assigned a unique, private identifier that represents the anchor’s location in the AR Cloud world. By sharing this identifier across sessions or with other SDK users, you enable all your users to refer to precisely the same location in the world, with a typical accuracy of a few centimeters.

Note

Once created, anchors are static, and cannot be moved. To build dynamic, shared AR experiences between multiple users, you can move your content relative to an anchor that all of the users have access to.

Each anchor is associated with a GameObject in the active view, so you can add child nodes to the anchor node as usual, and the ARCloudSession will take care of keeping the content stable for you.

Creating an anchor

To create an AR Cloud anchor, you must place a GameObject in so that it is at the desired position and orientation in your device’s local scene. You then pass this object to the ARCloudSession, which will make a request to the Blue Vision AR Cloud to initialize a new anchor. On success, the anchor’s unique identifier will be returned, and the anchor will being tracked by the session.

// Place a sphere one meter front of the camera.
var node = GameObject.CreatePrimitive(PrimitiveType.Sphere);
node.transform.position = GoogleARCore.Frame.Pose.position + new Vector3(0, 0, -1.0f);
node.transform.rotation = GoogleARCore.Frame.Pose.rotation;

arCloudSession.createAnchor(node, (anchor, error) => {
    if (anchor == null) {
        print("Anchor was not created: " + error);
        return;
    }

    // The anchor was successfully created. The
    // identifier can be shared with other users
    // to refer to the position one meter in front of
    // this device's camera.
    print("Anchor was created: " + anchor.identifier);
});

Retrieving an anchor

To retrieve an anchor from AR Cloud, you first need its unique identifier. In the previous step, a snippet was provided to creating an anchor in front of the camera and print its identifier. Supposing the identifier printed were 5c2229d1-0c45-4ef9-8b17-f977a8c28086, we could load that anchor into the scene view on another user’s device by adding the identifier to the active AR Cloud session.

arCloudSession.retrieveAnchor("5c2229d1-0c45-4ef9-8b17-f977a8c28086", (anchor, error) => {
    if (anchor == null) {
        print("Anchor was not retrieved: " + error);
        return;
    }

    // Add a sphere to the scene, one meter in front of the
    // camera for the device in the previous step.
    var node = GameObject.CreatePrimitive(PrimitiveType.Sphere);
    node.transform.parent = anchor.transform;
    node.transform.localPosition = Pose.identity.position;
    node.transform.localRotation = Pose.identity.rotation;
});

Anchors are designed to remain stable so that even months later, the anchor will still be available and refer to the same position in space.

For more information, the SDK documentation is available here. If you have any questions, you can contact us.

Next steps