summaryrefslogtreecommitdiff
path: root/src/ui/android/README
blob: 7adb7fe501034e005daf0912c0491dd81452d9db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
= Overview =

This directory contains a sample Android app tht uses
the Android speech recognition and TTS APIs along with
JNI bindings to the C PGF runtime to implement a simple
speech translation app.


= Requirements =

1. Android SDK: http://developer.android.com/sdk/
   installed in $ANDROID_SDK_LOCATION

2. Android NDK: http://developer.android.com/tools/sdk/ndk/
   installed in	$ANDROID_NDK_LOCATION

= Building =

Set up Android project:

# Creates local.properties, not to be checked in
$ $ANDROID_SDK_LOCATION/tools/android update project -p .

Build libs/libjpgf.jar:

$ (cd ../../runtime/java && javac org/grammaticalframework/*/*.java && jar -cf ../../ui/android/libs/jpgf.jar org/grammaticalframework/*/*.class)

Build JNI code:

$ cd jni
$ $ANDROID_NDK_LOCATION/ndk-build

Build the semantic database code:

$ runghc glosses.hs

Build APK:

$ ant debug


Install on your device:

$ ant debug install

or:

$ adb install -r bin/MainActivity-debug.apk


= Changing the grammar =

1. Replace assets/ResourceDemo.pgf

2. Edit Translator.java to point to the new file and include its metadata


= Developing in Eclipse =

1. Install Android ADT

2. Eclipse > File > Import > Existing Projects into Workspace > Next

3. Select root directory...

4. Select GF/src/ui/android

5. Finish