Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Mulder committed Aug 20, 2013
2 parents 8f7abb7 + b1835a4 commit 17b7da6
Show file tree
Hide file tree
Showing 14 changed files with 502 additions and 1,047 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,52 @@ See this projects' [GitHub pages](http://senseobservationsystems.github.com/sens

Please read the tutorial on the [Sense Developer Portal](http://developer.sense-os.nl/Libraries/Android).

## Maven

When using Maven (3.0.5+), you can add this project as an
[APKLIB](https://code.google.com/p/maven-android-plugin/wiki/ApkLib)
into your local Maven repository as follows.

First add some dependencies to your local Maven repository that are not available
in Maven central:

#### Dependency 1: compatibility-v4 library (rev 12)

Note that you need the compatibility-v4 library, revision 12. Google didn't put that
into Maven central (yet). If your local Maven repository does not contain it, install
it locally by using the
[maven-android-sdk-deployer](https://github.com/mosabua/maven-android-sdk-deployer).

#### Dependency 2: cordova 2.7.0

Navigate to the Library's `libs/` folder and execute the following command:

```bash
mvn install:install-file \
-Dfile=cordova-2.7.0.jar \
-DgroupId=org.apache.cordova \
-DartifactId=cordova \
-Dversion=2.7.0 \
-Dpackaging=jar \
-DgeneratePom=true
```
Now put the Sense Library to your local Maven repository:

```bash
git clone https://github.com/senseobservationsystems/sense-android-library
cd sense-android-library/sense-android-library/
mvn install
```
which should result in a `BUILD SUCCESS`.

After that, you can reference the Sense Library in a Maven-flavoured Android App
by adding the following dependency to your POM:

```xml
<dependency>
<groupId>nl.sense_os</groupId>
<artifactId>sense-android-library</artifactId>
<version>1.0-SNAPSHOT</version>
<type>apklib</type>
</dependency>
```
37 changes: 37 additions & 0 deletions sense-android-library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5+'
}
}
apply plugin: 'android-library'

repositories {
mavenCentral()
}

dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile files('libs/gcm.jar', 'libs/cordova-2.7.0.jar')
}

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

instrumentTest.setRoot('tests')
}
}
Binary file modified sense-android-library/libs/android-support-v4.jar
Binary file not shown.
79 changes: 79 additions & 0 deletions sense-android-library/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>nl.sense_os</groupId>
<artifactId>sense-android-library</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>apklib</packaging>
<name>sense-android-library</name>

<dependencies>

<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4</artifactId>
<version>12</version>
</dependency>

<dependency>
<groupId>com.google.android.gcm</groupId>
<artifactId>gcm-client</artifactId>
<version>3</version>
</dependency>

<dependency>
<groupId>org.apache.cordova</groupId>
<artifactId>cordova</artifactId>
<version>2.7.0</version>
</dependency>

</dependencies>

<build>

<sourceDirectory>src</sourceDirectory>

<plugins>

<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>17</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>

</plugins>

</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private void checkVersion() {

String url = SenseUrls.VERSION + "?version=" + versionName;
Map<String, String> response = SenseApi.request(this, url, null, null);
JSONObject content = new JSONObject(response.get("content"));
JSONObject content = new JSONObject(response.get(SenseApi.RESPONSE_CONTENT));

if (content.getString("message").length() > 0) {
Log.i(TAG, "Newer Sense App version available: " + content.toString());
Expand Down
Loading

0 comments on commit 17b7da6

Please sign in to comment.