You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make alterations to the following files in your project:
30
+
### Automatic
31
31
32
-
### Android
32
+
`react-native link react-native-activity-recognition`
33
33
34
-
#### `android/settings.gradle`
34
+
IMPORTANT NOTE: You'll need to follow Step 4 for both iOS and Android of manual-linking
35
35
36
+
### Manual
37
+
38
+
Make alterations to the following files in your project:
39
+
40
+
#### Android
41
+
42
+
1. Add following lines to `android/settings.gradle`
36
43
```gradle
37
44
...
38
45
include ':react-native-activity-recognition'
39
46
project(':react-native-activity-recognition').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-activity-recognition/android')
40
47
...
41
48
```
42
49
43
-
#### `android/app/build.gradle`
44
-
50
+
2. Add the compile line to dependencies in `android/app/build.gradle`
45
51
```gradle
46
52
...
47
53
dependencies {
@@ -51,8 +57,7 @@ dependencies {
51
57
}
52
58
```
53
59
54
-
#### `android/app/src/.../MainApplication.java`
55
-
60
+
3. Add import and link the package in `android/app/src/.../MainApplication.java`
// Stop activity detection and remove the listener
109
116
ActivityRecognition.stop()
110
117
this.unsubscribe()
111
118
```
112
119
113
-
`detectedActivities` is an object with keys for each detected activity, each of which have an integer percentage (0-100)
114
-
indicating the likelihood that the user is performing this activity. For example:
120
+
### Android
121
+
122
+
`detectedActivities` is an object with keys for each detected activity, each of which have an integer percentage (0-100) indicating the likelihood that the user is performing this activity. For example:
115
123
116
124
```js
117
125
{
@@ -134,7 +142,7 @@ confidence value:
134
142
]
135
143
```
136
144
137
-
Because the activities are sorted by confidence level, the first value will be the one with the highest probability.
145
+
Because the activities are sorted by confidence level, the first value will be the one with the highest probability
138
146
Note that ON_FOOT and WALKING are related but won't always have the same value. I have never seen WALKING with a higher
139
147
confidence than ON_FOOT, but it may happen that WALKING comes before ON_FOOT in the array if they have the same value.
140
148
@@ -149,40 +157,21 @@ The following activity types are supported:
// Stop activity detection and remove the listener
182
-
ActivityRecognition.stop()
162
+
`detectedActivities` is an object with key to the detected activity with a confidence value for that activity given by CMMotionActivityManager. For example:
163
+
```js
164
+
{
165
+
WALKING: 2
166
+
}
183
167
```
184
168
185
-
`detectedActivities` is an object with keys for each detected activity with the value of probable activity as true.
169
+
`detectedActivities.sorted` getter will return it in the form of an array.
170
+
```js
171
+
[
172
+
{type: "WALKING", confidence: 2}
173
+
]
174
+
```
186
175
187
176
The following activity types are supported:
188
177
@@ -193,18 +182,6 @@ The following activity types are supported:
0 commit comments