android docs update

This commit is contained in:
Joseph Henry
2016-08-25 14:24:13 -07:00
parent 0180cbe5cd
commit 95f74b18f6
2 changed files with 54 additions and 54 deletions

View File

@@ -16,37 +16,37 @@ 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() {
```
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()) { }
```
}).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 `<application>`:
```
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```
```
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```
**Step 3: Set NDK/SDK paths**
- Specify your SDK/NDK path in `android_jni_lib/proj/local.properties`. For example:

View File

@@ -16,37 +16,37 @@ 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() {
```
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()) { }
```
}).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 `<application>`:
```
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```
```
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```
**Step 3: Set NDK/SDK paths**
- Specify your SDK/NDK path in `android_jni_lib/proj/local.properties`. For example: