Getting Started with the Tango Java API

In this tutorial, we'll go through setting up your build environment and
compiling and running your first "Hello Tango" project using the Java API, which
will run sample code and display the pose data from your device.

In the Select Eclipse or Gradle Project to Import dialog, navigate to
the repository you just cloned. Choose the java_basic_examples
directory and then click OK.

Note: If an error appears that says "failed to find target-android-19"
and offers you a link to "Install missing platform(s) and sync project",
click that link and go through the steps to update your Android platform.

Connect your device

If you haven't already connected your Tango device to your computer,
you should do so now.

Build and run an application

Within the basic examples project you loaded, you have a choice of several
different "hello"-style apps to build and run. For this tutorial, we'll choose
"Hello Motion Tracking."

On the toolbar, view the Run/Debug Configuration field and make sure
hello_motion_tracking is the active configuration. If it is not, click
the field and select it.

Do one of the following:

On the Run menu, click Run.

On the toolbar, click the Run button (the green arrow).

In the Device Chooser dialog, select Choose a running device, then
select your Tango tablet, and then click OK.

Note: If your device isn't showing up in the Device Chooser dialog, make sure
it is plugged in and has Developer options enabled. For more information,
see "Enabling On-device Developer
Options".

See logcat for the raw pose data

You can see logcat output automatically in the bottom part of Android Studio.

Add to your own project

The Tango SDK for Java components are distributed on
Bintray
and are available through the JCenter repository when using Maven.

First, add jcenter() to your build.gradle file so Gradle can find the
AARs. For example:

allprojects {
repositories {
jcenter()
}
}

Add the appropriate dependencies to the build.gradle files in your
modules. You can determine this by looking at the samples' build.gradle
files to see what each one needs. For example, our motion tracking sample
uses:

The latest version looks like 1.51 and can be found on the
downloads page. This code indicates that an application
similar to the motion tracking sample needs sdk-base and
support-base. This will also recursively fetch dependent libraries.

Once this is done for all of the required libraries, you will be able to
reference code in the Tango SDK in your app.

If you are using your own build system, the Tango libraries are also available
from the downloads page.

Next steps

Now that you have learned how to set up your environment for development with
the Tango Java API, proceed to the following links to learn how to use
specific features of Tango in your app: