| 1 |
|
| 2 |
*** |
| 3 |
Please note that this Android client has been deprecated in favor of Jonathan |
| 4 |
Bennett's new Android client that is available here: |
| 5 |
|
| 6 |
https://github.com/jp-bennett/Fwknop2/releases/ |
| 7 |
**** |
| 8 |
|
| 9 |
=============================================================================== |
| 10 |
FWKNOP for Android |
| 11 |
|
| 12 |
Max Kastanas <[email protected]> |
| 13 |
|
| 14 |
Based on fwknop C implementation by Damien Stuart |
| 15 |
=============================================================================== |
| 16 |
|
| 17 |
- For those that are interested in Android development for the fwknop project, |
| 18 |
the ./project/sdk.paths file is meant to provide JAVE_HOME and PATH definitions |
| 19 |
for the local JVM and the Android SDK and NDK installations. The general work |
| 20 |
flow is to first update the paths in in the sdk.paths file to point to the |
| 21 |
correct directories on your system, and you will also need to similarly update |
| 22 |
the sdk.dir and ndk.dir paths in the ./android/project/ant.properties file. |
| 23 |
Then: |
| 24 |
|
| 25 |
$ source ./project/sdk.paths |
| 26 |
|
| 27 |
- Then, start up the Android SDK: |
| 28 |
|
| 29 |
$ android & |
| 30 |
|
| 31 |
- Now, make updates to the fwknop/android/project/ files if implementing new |
| 32 |
functionality or fixing bugs. Then, with an Android emulator running: |
| 33 |
|
| 34 |
$ cd ./project |
| 35 |
$ ant clean |
| 36 |
$ ant debug |
| 37 |
$ adb install -r bin/fwknop-android-debug.apk |
| 38 |
|
| 39 |
- or - |
| 40 |
|
| 41 |
$ cd ./project |
| 42 |
$ ant clean |
| 43 |
$ ant release |
| 44 |
$ adb install bin/fwknop-android-release-unsigned.apk |
| 45 |
|
| 46 |
- With the new Android app installed now in the emulator, you can fire it up |
| 47 |
and use it to send SPA packets. |
| 48 |
|
| 49 |
|
| 50 |
### Legacy instructions follow: ### |
| 51 |
|
| 52 |
1. Requirements: |
| 53 |
|
| 54 |
a. Apache Ant (1.7.1) |
| 55 |
http://ant.apache.org/bindownload.cgi |
| 56 |
|
| 57 |
b. Android NDK (Android r5-linux) |
| 58 |
http://developer.android.com/sdk/ndk/index.html |
| 59 |
Unzip the contents under a directory ie: |
| 60 |
/home/yourname/tools/android-sdk-linux_86 |
| 61 |
|
| 62 |
c. Android SDK (Android r08-linux) |
| 63 |
http://developer.android.com/sdk/index.html |
| 64 |
Unzip the contents under a directory ie: |
| 65 |
/home/yourname/tools/android-ndk-r5 |
| 66 |
|
| 67 |
d. Include the Android SDK tools directory in your user PATH variable: |
| 68 |
export PATH=$PATH:/home/dev/tools/android-sdk-linux_86/tools:/home/yourname/tools/android-ndk-r5 |
| 69 |
|
| 70 |
e. Download an SDK Android platform, in a command shell type: "android &" |
| 71 |
to start up the "Android SDK and AVD Manager". Download an SDK |
| 72 |
platform (Android 2.1 and above is recommended) under the |
| 73 |
"Available Packages" section. |
| 74 |
|
| 75 |
f. Java SDK (1.6 and above) |
| 76 |
http://www.oracle.com/technetwork/java/javase/downloads/index.html |
| 77 |
|
| 78 |
g. Netbeans (6.9 and above) - Optional if you want to use Netbeans as |
| 79 |
the IDE: |
| 80 |
http://netbeans.org/downloads/ |
| 81 |
|
| 82 |
h. Netbeans Android plugin (0.11 and above) - Optional if you are using |
| 83 |
the Netbeans IDE: |
| 84 |
http://kenai.com/projects/nbandroid/pages/Install |
| 85 |
|
| 86 |
=============================================================================== |
| 87 |
2. Setup |
| 88 |
|
| 89 |
a. Untar the tar.gz file: |
| 90 |
tar -zxf fwknop-2.0.4.tar.gz |
| 91 |
|
| 92 |
b. Update the properties files with the path to the sdk and ndk tools: |
| 93 |
.../fwknop-android/project/build.properties |
| 94 |
sdk.dir=/home/yourname/tools/android-sdk-linux_86 |
| 95 |
ndk.dir=/home/yourname/tools/android-ndk-r5 |
| 96 |
|
| 97 |
If you are running Android-4.1.2 or later, then these paths should look |
| 98 |
more like: |
| 99 |
sdk.dir=/home/yourname/tools/android-sdk-linux |
| 100 |
ndk.dir=/home/yourname/tools/android-ndk-r8b |
| 101 |
|
| 102 |
c. Include the Android SDK platform directory in your user PATH variable |
| 103 |
export PATH=$PATH:/home/yourname/tools/android-sdk-linux_86/platforms-tools |
| 104 |
|
| 105 |
For Android-4.1.2: |
| 106 |
export PATH=$PATH:/home/yourname/android-sdk-linux/tools: \ |
| 107 |
/home/yourname/android-ndk-r8b:/home/yourname/android-sdk-linux/platform-tools |
| 108 |
|
| 109 |
d. Create a new Android device, in a command shell type: "android". |
| 110 |
This will start the android SDK and AVD Manager |
| 111 |
Under Virtual Devices create an AVD device and name it as "Android2.1" |
| 112 |
|
| 113 |
For Android-4.1.2 name the new AVD device "Android_fwknop" |
| 114 |
|
| 115 |
e. Update (if needed) project file with the right virtual device as above: |
| 116 |
.../fwknop-android/project/nbproject/project.properties |
| 117 |
platform.active=Android2.1 |
| 118 |
|
| 119 |
For Android-4.1.2 use the .../fwknop-android/project/nbproject/project-4.1.2.properties |
| 120 |
file (you might want to replace the project.properties file with this it). |
| 121 |
Also for Android-4.1.2 users, you will probably want to replace the |
| 122 |
build.properties file with the build-4.1.2.properties file. |
| 123 |
|
| 124 |
f. The relevant fwknop android C code can be found under the |
| 125 |
".../project/jni" directory: |
| 126 |
1. The ".../project/jni/libfwknop" directory should contain all of |
| 127 |
the .c and .h files from the main fwknop/lib/ directory (the |
| 128 |
libfko source files. You can copy all of the *.[ch] files from |
| 129 |
.../fwknop.../lib manually, or use the "get_libfko_files.sh" |
| 130 |
script. |
| 131 |
|
| 132 |
2. The ".../project/jni/fwknop" directory contains the code for |
| 133 |
the android-specific client code (with the Java Native Interface |
| 134 |
hooks). |
| 135 |
|
| 136 |
=============================================================================== |
| 137 |
3. Build |
| 138 |
|
| 139 |
a. To build the app make sure you're under the project directory: |
| 140 |
$> cd /home/yourname/.../fwknop-android/project |
| 141 |
|
| 142 |
b. To build the application type: |
| 143 |
$> ant jar |
| 144 |
|
| 145 |
=============================================================================== |
| 146 |
4. Run |
| 147 |
|
| 148 |
a. Now search under the .../fwknop-android/dist directory for a .apk |
| 149 |
file. You can copy the .apk file to your SD card by typing (make |
| 150 |
sure the Android Emulator is on): |
| 151 |
$> adb push Fwknop.apk /sdcard/ |
| 152 |
|
| 153 |
Then you can open it and install it from within your Android device |
| 154 |
using a Filemanager like Astro. Make sure that you have turned on the |
| 155 |
"Unknown Sources" Option under Application settings. |
| 156 |
|
| 157 |
=============================================================================== |
| 158 |
5. Android Emulator |
| 159 |
|
| 160 |
If you don't have a device you can install and run Fwknop in the Android |
| 161 |
emulator. To do so follow these steps: |
| 162 |
$> android |
| 163 |
|
| 164 |
Under the virtual devices find your device "Android2.1" and start it up |
| 165 |
|
| 166 |
In a command line type: |
| 167 |
$> adb install Fwknop.apk |
| 168 |
|
| 169 |
You can now find the Firewall Knock Operator app under the menu tap on |
| 170 |
the icon to get started. |
| 171 |
|
| 172 |
=============================================================================== |
| 173 |
6. Developing with Netbeans |
| 174 |
|
| 175 |
To develop and build with Netbeans make sure you have installed the nbandroid |
| 176 |
plugin (see requirements. Once you have that install a new Java platform under |
| 177 |
the Tool -> Java Platforms and choose a Google Android platform, navigate |
| 178 |
under the SDK platform directory you downloaded under step 1e. Finally, just |
| 179 |
open the .../fwknop-android/project directory as a Netbeans project. |
| 180 |
|
| 181 |
=============================================================================== |
| 182 |
7. Debugging |
| 183 |
|
| 184 |
You can use gdb to debug the app. Before you do so make sure you have the |
| 185 |
following attribute in your AndroidManifest.xml file: |
| 186 |
android:debuggable="true" |
| 187 |
Now rebuild the application and start the Android Emulator, then in a command |
| 188 |
shell type: |
| 189 |
$> ndk-gdb --project=<path-to>/android/project |
| 190 |
|
| 191 |
This will start gdb in remote debugging, similarly you can follow the same |
| 192 |
steps to debug a physical device |
| 193 |
|
| 194 |
=============================================================================== |
| 195 |
Changelog |
| 196 |
v0.9 Dec 28 2010 |
| 197 |
1) Rijndael client support |
| 198 |
2) Local and External IP resolution |
| 199 |
2) Automatically start ConnectBot |
| 200 |
|
| 201 |
|