Skip to content

Commit c1f6751

Browse files
authored
Merge pull request #18 from galziv/master
updated files to support latest react-native v0.57.5
2 parents c087242 + c84bf7e commit c1f6751

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[![npm version][npm shield]][npm url]
44

55
React Native wrapper for the [Android Activity Recognition API][1] and [CMMotionActivity][3]. It attempts to determine the user activity such as
6-
driving, walking, running and cycling. Possible detected activities for android are [listed here][2] and for iOS are [listed here][3].
6+
driving, walking, running and cycling. Possible detected activities for android are [listed here][2] and for iOS are [listed here][3].<br/>
7+
Updated January 7th and tested with react-native v0.57.5
78

89
[1]: https://developers.google.com/android/reference/com/google/android/gms/location/ActivityRecognition
910
[2]: https://developers.google.com/android/reference/com/google/android/gms/location/DetectedActivity

android/build.gradle

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
buildscript {
22
repositories {
33
jcenter()
4+
google()
45
}
56
dependencies {
6-
classpath 'com.android.tools.build:gradle:2.2.0'
7+
classpath 'com.android.tools.build:gradle:3.1.4'
78
}
89
}
910

@@ -14,27 +15,29 @@ allprojects {
1415
maven {
1516
url "$rootDir/../node_modules/react-native/android"
1617
}
18+
google()
1719
}
1820
}
1921

2022
apply plugin: 'com.android.library'
2123

2224
android {
23-
compileSdkVersion 24
24-
buildToolsVersion "24.0.3"
25+
compileSdkVersion 27
26+
buildToolsVersion "27.0.3"
2527

2628
defaultConfig {
27-
minSdkVersion 16
28-
targetSdkVersion 24
29+
minSdkVersion 18
30+
targetSdkVersion 26
2931
versionCode 1
3032
versionName "1.0"
33+
multiDexEnabled true
3134
}
3235
lintOptions {
3336
abortOnError false
3437
}
3538
}
3639

3740
dependencies {
38-
compile 'com.facebook.react:react-native:+'
39-
compile 'com.google.android.gms:play-services:+'
41+
api 'com.facebook.react:react-native:+'
42+
api 'com.google.android.gms:play-services:+'
4043
}

android/src/main/java/com/xebia/activityrecognition/RNActivityRecognitionPackage.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.facebook.react.bridge.ReactApplicationContext;
77
import com.facebook.react.uimanager.ViewManager;
88

9+
import java.util.ArrayList;
910
import java.util.Arrays;
1011
import java.util.Collections;
1112
import java.util.List;
@@ -19,8 +20,13 @@ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext
1920

2021
@Override
2122
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
22-
return Arrays.<NativeModule>asList(
23-
new RNActivityRecognitionNativeModule(reactContext)
24-
);
23+
List<NativeModule> modules = new ArrayList<>();
24+
modules.add(new RNActivityRecognitionNativeModule(reactContext));
25+
26+
return modules;
27+
}
28+
29+
public List<Class<? extends JavaScriptModule>> createJSModules() {
30+
return Collections.emptyList();
2531
}
2632
}

0 commit comments

Comments
 (0)