-
Notifications
You must be signed in to change notification settings - Fork 356
IOIOLib Basics
IOIOLib is an Android library, which enables your Android application to control the IOIO board. It exposes a set of Java interfaces, covering the various features of the board. When you build your application, IOIOLib gets packaged into your target .apk
file, so your application is stand-alone and does not require any further installation on the Android device that runs it. The entire code is pure Java, depending solely on the standard Android 1.5 (or later) framework.
IOIOLib is all documented in standard Javadoc format, and this documentation is intended to be comprehensive and be used as reference while coding. In this User Guide, we try to cover usage of the library from a common-use-cases approach rather than be 100% formal.
The library is organized in several Java packages. The ioio.api
package contains all the public API for controlling the IOIO. This is the package your application will be using. Within it, the ioio.api.exception
package contains some exceptions thrown by the IOIO API. The ioio.impl
package contains the implementation of these interfaces and is not intended to be used directly. The ioio.util
package contains useful utilities that may make your life a little easier when writing IOIO applications, but do not provide core functionality. At the time of writing this, this package only contains a single class, serving as a base class for your IOIO-based application, which automatically handles proper connection / disconnection to the IOIO board in response for application events.
If you are not familiar with Android application development and/or have not yet setup your development environment, the IOIO Beginner's Guide page may provide useful information.
The latest version IOIOLib can be downloaded from the Downloads page. It is a part of the "Android Software" zip. This zip also includes some sample applications.
We're only going to cover usage with Eclipse here, with the assumption that users not using Eclipse for Android application development probably know what they're doing :)
- Extract
IOIOLib
to somewhere where you normally want to keep your Android projects. - Import it into Eclipse using File > Import... > General > Existing Projects into Workspace..., then choose the IOIOLib directory you just created and click Finish.
- Reference it from your application project, according to these instructions
- Make sure your application declares using the
android.permission.INTERNET
permission. This can set by opening theAndroidManifest.xml
file found at your project's root, going to the Permissions tab > Add... > Uses Permission > Selectandroid.permission.INTERNET
under "Name". - Make sure you enabled USB debugging on your Android device, by going to Settings > Applications > Development > Enable USB Debugging.
IOIOLib includes two main parts:
- The IOIOLib Core API, which comprises a platform-independent API for controlling all the IOIO functions. Read more here.
- The IOIOLib Application Framework, which comprises platform- and application-type-specific utilities to simplify the creation of various common kinds of applications. It is not strictly necessary to use the application framework for working with the IOIO, but it is highly recommended, since it hides away many of the delicate bootstraping and threading issues required for a reliable and robust IOIO-based application. Read more here.