Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.

Developer Guide

barbeau edited this page Aug 21, 2012 · 41 revisions

This page contains instructions for configuring and building the OpenTripPlanner Android app from the source code.

Getting Started

First, you'll need a JDK installed. We recommend JDK 1.6.

Next, we suggest you use Eclipse for an IDE (The "EE" version is suggested). You'll also need the Android SDK, and finally the Eclipse Android plugins. Follow the instructions at the above linked pages to set up Eclipse and the Android SDK and plugin.

Getting the code

The OTP Android app code is versioned using Git, so you can use your favorite Git client or the Eclipse Git Plugin "EGit" to clone the OTP Android repository

Here's our Github repo:

https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android.git

If you plan on submitting improvements, we suggest you fork our project (instead of cloning our repo directly) and work off of your forked repo so you can commit to your own OTP Android repository and use Github's Pull Request feature to submit improvements for our review.

Building and running the project

Use the normal Eclipse "Clean and build" process. Then, run the Android project on your device or an Android emulator. Yup, its that easy!

Components

Here's a list of some components that are used in the functionality of the OTP for Android app:

  • OSM Droid - Used for the map tiles and map overlays.
  • OTP Java Client project - handles the serialization of REST API requests to the OTP server, and the deserialization of REST API responses from the OTP server.
  • OTP Server Directory (a Google Docs spreadsheet) - maintains the centralized list of OTP Server deployments and their coverage areas, so the client knows which OTP server it should communicate with
  • Google Places API - Used for point-of-interest search. Provides rich results based on Google's database for areas such as the U.S. Requires a developer key (see Customization section below).
  • Nominatim - Also used for point-of-interest search. Provides results for points-of-interest that are recorded in OpenStreetMap, which may provide more information than Google Places API for international locations (depending on the quality of Google Maps in the area).

Customization

Setting up your own Google Places API key

To use the Google Places API, you need a developer key. This key should be your own private key, so by default we don't include a key in the repository.

To add your own key, create a text file “res/raw/googleplaceskey.txt” in the Android project that contains only your developer key in plain text. The app will check for this key file when using the Google Places API, and if the key exists the app will use it.

Updating the mobile REST API interface

We separate the mobile REST API interface code into a different project. Check out the OTP Java Client project for more information about the mobile REST API code.

Troubleshooting

If you hit a compilation problem in Eclipse, we recommend cleaning your application, then shutting down Eclipse. Restart Eclipse, and then build the project. This solves most issues.

Clone this wiki locally