Please note that this Android client has been deprecated in favor of Jonathan
Bennett's new Android client that is available here:

FWKNOP for Android

Max Kastanas <>

Based on fwknop C implementation by Damien Stuart

- For those that are interested in Android development for the fwknop project,
the ./project/sdk.paths file is meant to provide JAVE_HOME and PATH definitions
for the local JVM and the Android SDK and NDK installations.  The general work
flow is to first update the paths in in the sdk.paths file to point to the
correct directories on your system, and you will also need to similarly update
the sdk.dir and ndk.dir paths in the ./android/project/ file.

$ source ./project/sdk.paths

- Then, start up the Android SDK:

$ android &

- Now, make updates to the fwknop/android/project/ files if implementing new
functionality or fixing bugs.  Then, with an Android emulator running:

$ cd ./project
$ ant clean
$ ant debug
$ adb install -r bin/fwknop-android-debug.apk

 - or -

$ cd ./project
$ ant clean
$ ant release
$ adb install bin/fwknop-android-release-unsigned.apk

- With the new Android app installed now in the emulator, you can fire it up
and use it to send SPA packets.

### Legacy instructions follow: ###

1. Requirements:

    a. Apache Ant (1.7.1)

    b. Android NDK (Android r5-linux)
        Unzip the contents under a directory ie:

    c. Android SDK (Android r08-linux)
        Unzip the contents under a directory ie:

    d. Include the Android SDK tools directory in your user PATH variable:
        export PATH=$PATH:/home/dev/tools/android-sdk-linux_86/tools:/home/yourname/tools/android-ndk-r5

    e. Download an SDK Android platform, in a command shell type: "android &"
       to start up the "Android SDK and AVD Manager".  Download an SDK
       platform (Android 2.1 and above is recommended) under the
       "Available Packages" section.

    f. Java SDK (1.6 and above)

    g. Netbeans (6.9 and above) - Optional if you want to use Netbeans as
       the IDE:

    h. Netbeans Android plugin (0.11 and above) - Optional if you are using
       the Netbeans IDE:

2. Setup

    a. Untar the tar.gz file:
        tar -zxf fwknop-2.0.4.tar.gz

    b. Update the properties files with the path to the sdk and ndk tools:

       If you are running Android-4.1.2 or later, then these paths should look
       more like:

    c. Include the Android SDK platform directory in your user PATH variable
        export PATH=$PATH:/home/yourname/tools/android-sdk-linux_86/platforms-tools

       For Android-4.1.2:
        export PATH=$PATH:/home/yourname/android-sdk-linux/tools: \

    d. Create a new Android device, in a command shell type: "android".
        This will start the android SDK and AVD Manager
        Under Virtual Devices create an AVD device and name it as "Android2.1"

       For Android-4.1.2 name the new AVD device "Android_fwknop"

    e. Update (if needed) project file with the right virtual device as above:

       For Android-4.1.2 use the .../fwknop-android/project/nbproject/
       file (you might want to replace the file with this it).
       Also for Android-4.1.2 users, you will probably want to replace the file with the file.

    f. The relevant fwknop android C code can be found under the
       ".../project/jni" directory:
         1. The ".../project/jni/libfwknop" directory should contain all of
            the .c and .h files from the main fwknop/lib/ directory (the
            libfko source files.  You can copy all of the *.[ch] files from
            .../fwknop.../lib manually, or use the ""

         2. The ".../project/jni/fwknop" directory contains the code for
            the android-specific client code (with the Java Native Interface

3. Build

    a. To build the app make sure you're under the project directory:
        $> cd /home/yourname/.../fwknop-android/project

    b. To build the application type:
        $> ant jar

4. Run

    a. Now search under the .../fwknop-android/dist directory for a .apk
       file.  You can copy the .apk file to your SD card by typing (make
       sure the Android Emulator is on):
            $> adb push Fwknop.apk /sdcard/

    Then you can open it and install it from within your Android device
    using a Filemanager like Astro. Make sure that you have turned on the 
    "Unknown Sources" Option under Application settings.

5. Android Emulator

    If you don't have a device you can install and run Fwknop in the Android
    emulator. To do so follow these steps:
        $> android

    Under the virtual devices find your device "Android2.1" and start it up

    In a command line type:
        $> adb install Fwknop.apk

    You can now find the Firewall Knock Operator app under the menu tap on
    the icon to get started.

6. Developing with Netbeans

To develop and build with Netbeans make sure you have installed the nbandroid
plugin (see requirements. Once you have that install a new Java platform under
the Tool -> Java Platforms and choose a Google Android platform, navigate
under the SDK platform directory you downloaded under step 1e. Finally, just
open the .../fwknop-android/project directory as a Netbeans project.

7. Debugging

You can use gdb to debug the app.  Before you do so make sure you have the
following attribute in your AndroidManifest.xml file:
Now rebuild the application and start the Android Emulator, then in a command
shell type:
    $> ndk-gdb --project=<path-to>/android/project

This will start gdb in remote debugging, similarly you can follow the same
steps to debug a physical device

v0.9 Dec 28 2010
1) Rijndael client support
2) Local and External IP resolution
2) Automatically start ConnectBot