<commit_before># Thali Cordova Plugin

<Work on progress, not near release quality !!>

## Goals

The Thali Cordova Plugin is an easy-to-use [Cordova](http://cordova.apache.org/) plugin for building peer-to-peer (P2P) networking apps on Android and iOS.

The Thali Cordova Plugin is layered on the [JXcore Cordova plugin](https://github.com/jxcore/jxcore-cordova), which uses [JXcore](http://jxcore.com/home/) to allow one to build mobile applicatons in JavaScript for Node.JS.  

## Prerequisites

### Android

Download [Android Studio](http://developer.android.com/sdk/index.html)

Make sure to set your `ANDROID_HOME` environment variable:

Mac OS X (put in your `~/.bash_profile` file):
```
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
```

Linux (put in your `~/.bashrc` file):
```
export ANDROID_HOME=/<installation location>/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
```

Windows:
```
set ANDROID_HOME=C:\<installation location>\Android\sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
```

### iOS

Download [Xcode 6](https://developer.apple.com/xcode/), or later.

## Getting Started

### Install latest Node.JS

Follow the instructions at [https://nodejs.org/](https://nodejs.org/). When you're done, check that the
installation worked:
```
$ node -v
v0.12.7
$ npm -v
2.11.3
```

### Install Cordova

(Check the [Android Platform Guide](https://cordova.apache.org/docs/en/4.0.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide)
and [iOS Platform Guide](https://cordova.apache.org/docs/en/4.0.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide) for detailed instructions.)

```
$ sudo npm install -g cordova
```

### Create a Cordova project

```
~/Code> cordova create ThaliTest com.test.thalitest ThaliTest
```

### Android Requirements

### Use Gradle

For the command line build process, you should use gradle. Set the system environment variable `ANDROID_BUILD` to `gradle`.

### Build the P2P library to local Maven

#### Install Maven locally
Follow the instructions here: http://maven.apache.org/download.cgi

#### Clone the Thali Cordova Plugin library
`git clone https://github.com/thaliproject/Thali_CordovaPlugin_BtLibrary.git`  

#### Build the Thali Cordova Plugin library
At the root of the Thali Cordova Plugin Library that you just git cloned:  

`cd BtConnectorLib`

Note: On OS X (and probably Linux) the gradlew file is cloned without execution permissions. So you have to run:

`chmod u+x gradlew`

before you will be able to run the next command.

`./gradlew build install`  

Once built the library should be visible in:  
`<user folder>\.m2\repository\org\thaliproject\p2p\btconnectorlib\btconnectorlib2\0.0.0`


Once built the library should be visible in:  
`<user folder>\.m2\repository\org\thaliproject\p2p\btconnectorlib\btconnectorlib2\0.0.0`

### Using the Thali Cordova Plugin

Follow the instructions below to use the Thali Cordova Plugin on Android and iOS.

#### Android

1. Add the Android platform
   * `cd ThaliTest`
   * `cordova platform add android`
2. Fix manifest min-sdk issue
   * go to `ThaliTest\platforms\android` and in `AndroidManifest.xml` change `android:minSdkVersion="10"` to<commit_msg>Fixing readme per PR comments<commit_after># Thali Cordova Plugin

This project is a work in progress and not yet production-level quality.

The Thali Cordova Plugin is a [Cordova](http://cordova.apache.org/) plugin for building peer-to-peer (P2P) networking apps on Android and iOS.

The Thali Cordova Plugin is layered on the [JXcore Cordova plugin](https://github.com/jxcore/jxcore-cordova), which uses [JXcore](http://jxcore.com/home/) to allow one to build mobile applications in JavaScript for Node.JS.  

## Prerequisites

### Android

Download [Android Studio](http://developer.android.com/sdk/index.html)

Make sure to set your `ANDROID_HOME` environment variable:

Mac OS X (put in your `~/.bash_profile` file):
```
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
```

Linux (put in your `~/.bashrc` file):
```
export ANDROID_HOME=/<installation location>/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
```

Windows:
```
set ANDROID_HOME=C:\<installation location>\Android\sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
```

### iOS

Download [Xcode 6](https://developer.apple.com/xcode/), or later.

## Getting Started

### Install latest Node.JS

Follow the instructions at [https://nodejs.org/](https://nodejs.org/). When you're done, check that the
installation worked:
```
$ node -v
v0.12.7
$ npm -v
2.11.3
```

### Install Cordova

(Check the [Android Platform Guide](https://cordova.apache.org/docs/en/4.0.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide)
and [iOS Platform Guide](https://cordova.apache.org/docs/en/4.0.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide) for detailed instructions.)

```
$ sudo npm install -g cordova
```

### Create a Cordova project

```
~/Code> cordova create ThaliTest com.test.thalitest ThaliTest
```

### Android Requirements

#### Use Gradle

For the command line build process, you should use gradle. Set the system environment variable `ANDROID_BUILD` to `gradle`.

#### Build the P2P library to local Maven

##### Install Maven locally
Follow the instructions here: http://maven.apache.org/download.cgi

##### Clone the Thali Cordova Plugin library
`git clone https://github.com/thaliproject/Thali_CordovaPlugin_BtLibrary.git`  

##### Build the Thali Cordova Plugin library
At the root of the Thali Cordova Plugin Library that you just git cloned:  

`cd BtConnectorLib`

Note: On OS X (and probably Linux) the gradlew file is cloned without execution permissions. So you have to run:

`chmod u+x gradlew`

before you will be able to run the next command.

`./gradlew build install`  

Once built the library should be visible in:  
`<user folder>\.m2\repository\org\thaliproject\p2p\btconnectorlib\btconnectorlib2\0.0.0`


Once built the library should be visible in:  
`<user folder>\.m2\repository\org\thaliproject\p2p\btconnectorlib\btconnectorlib2\0.0.0`

### Using the Thali Cordova Plugin

Follow the instructions below to use the Thali Cordova Plugin on Android and iOS.

#### Android

1. Add the Android platform
   * `cd ThaliTest`
   * `cordova platform add android`
2. Fix manifest min-sdk issue
   * go to `ThaliTest\platforms\android` and in `AndroidManifest.xml` change `android:minSdkVersion="10"` to
{'fraction_non_alphanumeric': 0.12194385753093873, 'fraction_numerical': 0.012375490492001207, 'mean_word_length': 4.7676240208877285, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6376002', 'n_tokens_mistral': 2242, 'n_tokens_neox': 2104, 'n_words': 658}