Skip to content

Commit 17b7da6

Browse files
author
Steven Mulder
committed
Merge branch 'develop'
2 parents 8f7abb7 + b1835a4 commit 17b7da6

File tree

14 files changed

+502
-1047
lines changed

14 files changed

+502
-1047
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,52 @@ See this projects' [GitHub pages](http://senseobservationsystems.github.com/sens
1010

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

13+
## Maven
14+
15+
When using Maven (3.0.5+), you can add this project as an
16+
[APKLIB](https://code.google.com/p/maven-android-plugin/wiki/ApkLib)
17+
into your local Maven repository as follows.
18+
19+
First add some dependencies to your local Maven repository that are not available
20+
in Maven central:
21+
22+
#### Dependency 1: compatibility-v4 library (rev 12)
23+
24+
Note that you need the compatibility-v4 library, revision 12. Google didn't put that
25+
into Maven central (yet). If your local Maven repository does not contain it, install
26+
it locally by using the
27+
[maven-android-sdk-deployer](https://github.com/mosabua/maven-android-sdk-deployer).
28+
29+
#### Dependency 2: cordova 2.7.0
30+
31+
Navigate to the Library's `libs/` folder and execute the following command:
32+
33+
```bash
34+
mvn install:install-file \
35+
-Dfile=cordova-2.7.0.jar \
36+
-DgroupId=org.apache.cordova \
37+
-DartifactId=cordova \
38+
-Dversion=2.7.0 \
39+
-Dpackaging=jar \
40+
-DgeneratePom=true
41+
```
42+
Now put the Sense Library to your local Maven repository:
43+
44+
```bash
45+
git clone https://github.com/senseobservationsystems/sense-android-library
46+
cd sense-android-library/sense-android-library/
47+
mvn install
48+
```
49+
which should result in a `BUILD SUCCESS`.
50+
51+
After that, you can reference the Sense Library in a Maven-flavoured Android App
52+
by adding the following dependency to your POM:
53+
54+
```xml
55+
<dependency>
56+
<groupId>nl.sense_os</groupId>
57+
<artifactId>sense-android-library</artifactId>
58+
<version>1.0-SNAPSHOT</version>
59+
<type>apklib</type>
60+
</dependency>
61+
```

sense-android-library/build.gradle

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:0.5+'
7+
}
8+
}
9+
apply plugin: 'android-library'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
compile 'com.android.support:support-v4:13.0.0'
17+
compile files('libs/gcm.jar', 'libs/cordova-2.7.0.jar')
18+
}
19+
20+
android {
21+
compileSdkVersion 17
22+
buildToolsVersion "17.0.0"
23+
24+
sourceSets {
25+
main {
26+
manifest.srcFile 'AndroidManifest.xml'
27+
java.srcDirs = ['src']
28+
resources.srcDirs = ['src']
29+
aidl.srcDirs = ['src']
30+
renderscript.srcDirs = ['src']
31+
res.srcDirs = ['res']
32+
assets.srcDirs = ['assets']
33+
}
34+
35+
instrumentTest.setRoot('tests')
36+
}
37+
}
70.3 KB
Binary file not shown.

sense-android-library/pom.xml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
6+
7+
<modelVersion>4.0.0</modelVersion>
8+
<groupId>nl.sense_os</groupId>
9+
<artifactId>sense-android-library</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<packaging>apklib</packaging>
12+
<name>sense-android-library</name>
13+
14+
<dependencies>
15+
16+
<dependency>
17+
<groupId>com.google.android</groupId>
18+
<artifactId>android</artifactId>
19+
<version>4.1.1.4</version>
20+
<scope>provided</scope>
21+
</dependency>
22+
23+
<dependency>
24+
<groupId>android.support</groupId>
25+
<artifactId>compatibility-v4</artifactId>
26+
<version>12</version>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>com.google.android.gcm</groupId>
31+
<artifactId>gcm-client</artifactId>
32+
<version>3</version>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>org.apache.cordova</groupId>
37+
<artifactId>cordova</artifactId>
38+
<version>2.7.0</version>
39+
</dependency>
40+
41+
</dependencies>
42+
43+
<build>
44+
45+
<sourceDirectory>src</sourceDirectory>
46+
47+
<plugins>
48+
49+
<plugin>
50+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
51+
<artifactId>android-maven-plugin</artifactId>
52+
<version>3.6.1</version>
53+
<configuration>
54+
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
55+
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
56+
<resourceDirectory>${project.basedir}/res</resourceDirectory>
57+
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
58+
<sdk>
59+
<platform>17</platform>
60+
</sdk>
61+
<undeployBeforeDeploy>true</undeployBeforeDeploy>
62+
</configuration>
63+
<extensions>true</extensions>
64+
</plugin>
65+
66+
<plugin>
67+
<artifactId>maven-compiler-plugin</artifactId>
68+
<version>2.3.2</version>
69+
<configuration>
70+
<source>1.6</source>
71+
<target>1.6</target>
72+
</configuration>
73+
</plugin>
74+
75+
</plugins>
76+
77+
</build>
78+
79+
</project>

sense-android-library/src/nl/sense_os/service/SenseService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private void checkVersion() {
178178

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

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

0 commit comments

Comments
 (0)