diff --git a/docs/android_zt_sdk.md b/docs/android_zt_sdk.md index 0ba9a9a..7de05d3 100644 --- a/docs/android_zt_sdk.md +++ b/docs/android_zt_sdk.md @@ -16,45 +16,45 @@ If you want to skip the following steps and just take a look at the project, go - Start the service -``` -String nwid = "8056c2e21c000001"; -// Set up service -final ZTSDK zt = new ZTSDK(); -final String homeDir = getApplicationContext().getFilesDir() + "/zerotier"; -new Thread(new Runnable() { - public void run() { - // Calls to JNI code - zt.start_service(homeDir); - } -}).start(); -while(!zt.running()) { } -``` + ``` + String nwid = "8056c2e21c000001"; + // Set up service + final ZTSDK zt = new ZTSDK(); + final String homeDir = getApplicationContext().getFilesDir() + "/zerotier"; + new Thread(new Runnable() { + public void run() { + // Calls to JNI code + zt.start_service(homeDir); + } + }).start(); + while(!zt.running()) { } + ``` - Join network and start doing network stuff! -``` -zt.join_network(nwid); -int sock = zt.socket(zt.AF_INET, zt.SOCK_STREAM, 0); -int err = zt.connect(sock, "10.9.9.203", 8080, nwid); -// zt.recvfrom(), zt.write(), etc... -``` + ``` + zt.join_network(nwid); + int sock = zt.socket(zt.AF_INET, zt.SOCK_STREAM, 0); + int err = zt.connect(sock, "10.9.9.203", 8080, nwid); + // zt.recvfrom(), zt.write(), etc... + ``` **Step 2: App permissions** - In order for your application to write the auth keys and network files to the internal storage you'll need to set a few permissions in your `AndroidManifest.xml` file at the same scope level as ``: -``` - - -``` + ``` + + + ``` **Step 3: Set NDK/SDK paths** - Specify your SDK/NDK path in `android_jni_lib/proj/local.properties`. For example: - ``` - sdk.dir=/Users/Name/Library/Android/sdk - ndk.dir=/Users/Name/Library/Android/ndk-r10e - ``` + ``` + sdk.dir=/Users/Name/Library/Android/sdk + ndk.dir=/Users/Name/Library/Android/ndk-r10e + ``` **Step 4: Select build targets** - Specify the target architectures you want to build in [Application.mk](android/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`. For each architecture you wish to support a different shared library will need to be built. This is all taken care of automatically by the build script. diff --git a/integrations/android/README.md b/integrations/android/README.md index 0ba9a9a..7de05d3 100644 --- a/integrations/android/README.md +++ b/integrations/android/README.md @@ -16,45 +16,45 @@ If you want to skip the following steps and just take a look at the project, go - Start the service -``` -String nwid = "8056c2e21c000001"; -// Set up service -final ZTSDK zt = new ZTSDK(); -final String homeDir = getApplicationContext().getFilesDir() + "/zerotier"; -new Thread(new Runnable() { - public void run() { - // Calls to JNI code - zt.start_service(homeDir); - } -}).start(); -while(!zt.running()) { } -``` + ``` + String nwid = "8056c2e21c000001"; + // Set up service + final ZTSDK zt = new ZTSDK(); + final String homeDir = getApplicationContext().getFilesDir() + "/zerotier"; + new Thread(new Runnable() { + public void run() { + // Calls to JNI code + zt.start_service(homeDir); + } + }).start(); + while(!zt.running()) { } + ``` - Join network and start doing network stuff! -``` -zt.join_network(nwid); -int sock = zt.socket(zt.AF_INET, zt.SOCK_STREAM, 0); -int err = zt.connect(sock, "10.9.9.203", 8080, nwid); -// zt.recvfrom(), zt.write(), etc... -``` + ``` + zt.join_network(nwid); + int sock = zt.socket(zt.AF_INET, zt.SOCK_STREAM, 0); + int err = zt.connect(sock, "10.9.9.203", 8080, nwid); + // zt.recvfrom(), zt.write(), etc... + ``` **Step 2: App permissions** - In order for your application to write the auth keys and network files to the internal storage you'll need to set a few permissions in your `AndroidManifest.xml` file at the same scope level as ``: -``` - - -``` + ``` + + + ``` **Step 3: Set NDK/SDK paths** - Specify your SDK/NDK path in `android_jni_lib/proj/local.properties`. For example: - ``` - sdk.dir=/Users/Name/Library/Android/sdk - ndk.dir=/Users/Name/Library/Android/ndk-r10e - ``` + ``` + sdk.dir=/Users/Name/Library/Android/sdk + ndk.dir=/Users/Name/Library/Android/ndk-r10e + ``` **Step 4: Select build targets** - Specify the target architectures you want to build in [Application.mk](android/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`. For each architecture you wish to support a different shared library will need to be built. This is all taken care of automatically by the build script.