GPII Android Building

From wiki.gpii
Jump to: navigation, search

Running GPII Demos on Android

WARNING!

The information from this page is outdated and doesn't include the current way of building the GPII on Android. If you're looking for an updated information about building the GPII for Android you should go to the official build instructions.

Super Quick Summary

  1. Get the Android toolchain from Google
  2. Clone the GPII Android repository
  3. Run a shell script to set up the build environment
  4. Run the Ant script that is provided in our repository
  5. Run a command to install the built .apk onto the device
  6. Run another command to copy all GPII code onto an SD card
  7. Run another command to start the system


Rooting and Special Privileges

Rooting the phone is an optional step. The functionality available to you will depend on whether or not you root the phone and install the GPII package in a privileged directory. Here are the three possible scenarios you can choose from:

  1. If you want to only configure third-party apps such as FreeSpeech, you don't need to root the phone
  2. If you want to set built-in settings such as font size, you need to root the phone
  3. To stop and start core services such as Talkback and Brailleback, you need System Privileges. In that case, you can manually install the GPII .apk into the /system/apps directory (There are GUI tools to help with this, described below)

Detailed Instructions

We can use a pre built node apk to get started quickly with running the GPII on Android. Please note this is all very alpha, please don't use it on the mobile you use for making calls.

First, grab our current prebuilt Node APK and install it:

curl -O https://github.com/sgithens/gpii-android-test/raw/master/AnodeActivity.apk
adb install AnodeActivity.apk

Second, clone the android git repo and run the build script

mkdir gpii
cd gpii
git clone git@github.com:GPII/android.git
cd android
./build.sh

Third, transfer the files, replacing '/sdcard' with your preferred file location on the device. Because the universal repo contains some symlinks (which 'adb push' doesn't support), we zip it up. You can also use whatever development method you prefer for working with files on the device. (ssh, etc)

cd .. 
adb shell mkdir /sdcard/gpii
tar -c android node_modules > gpii.tar
adb push gpii.tar /sdcard/gpii/gpii.tar
adb shell 'cd /sdcard/gpii; tar -xvf gpii.tar'

Lastly, we can now start up node and run the gpii.

adb shell am start -a org.meshpoint.anode.MAIN
adb shell am broadcast -a org.meshpoint.anode.START -e cmdline /sdcard/gpii/android/gpii.js
adb logcat # You should see the standard GPII logging, and our server started on port 8081

For proper release versions we will bundle all the GPII javascript into an apk, this is just for development.

WSIS 2013 / Google I/O 2013 Demo Install

A snapshot of binaries used for our early Summer 2013 demos is available as well. These include demos for starting/talking Talkback, setting the fontsize, and launching Free Speech.

Installation is similar to the above (you will need the same tools and skill sets), with a few caveats.

First, grab the prebuilt APK.

curl -O https://github.com/sgithens/gpii-android-test/raw/master/GoogleIOAnodeActivity.apk

You can install it as in the above instructions with "adb install", but in order to start/stop Talkback we need to install it in to the "/system/app" folder. An easy way to do this is to install an Android File Manager such as "ES File Explorer" (available on Google Play, and other places). Using ES File Explorer you can do the following:

  1. Open the sidebar and go to: Root Explorer
  2. In Root Explorer you can then select: Mount R/W
  3. Mount /system as RW
  4. Then copy the APK from the /sdcard directory or elsewhere to /system/app
  5. Restart the device, and our Anode will be running as system

You don't *have* to install it in system if you don't need to demo talkback.

After installing the demo APK, fetch the following and use adb push to copy it to the device similar to above.

curl -O https://github.com/sgithens/gpii-android-test/raw/master/gpii-googleio.tar.gz
adb push gpii-googleio.tar.gz /sdcard/gpii-googleio.tar.gz
adb shell 'cd /sdcard/; tar -xzvf gpii-googleio.tar.gz'

Also install Tony Atkins Free Speech app from Google Play or his site.

With this installed, we have 3 demo personas for special use on Android:

  1. paulina : Starts/stops Talkback
  2. wayne : Start Free Speech
  3. maguro / gert : Increases/Decreases Fontsize

Building Node and All

This uses several Android build toolchains, and until we have automated the build scripts will require a fair amount of existing Android experience to run the build. To build the entire stack from scratch you will need have *both* the Android SDK and Android NDK installed.

The overall build process is as follows:

  1. Clone the usual Github repositories as usual
  2. Build a number of C/C++ native modules using the Android NDK
  3. Build the Anode/GPII APK using the Android SDK
  4. Include GPII specific modules and install everything on to the phone

These steps are literally for building the entire stack, including node.js itself from scratch. Once we reach a certain level of stability, we will make binary builds of the lower level steps available, and the entire APK itself, so GPII users can program in declarative JSON as usual.

Back to Android Overview