react-native-geo-activity-kit 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,11 +22,15 @@ class ActivityTransitionReceiver : BroadcastReceiver() {
|
|
|
22
22
|
|
|
23
23
|
Log.d("ActivityReceiver", "🏃 Motion Event: $activityType ($transitionType)")
|
|
24
24
|
|
|
25
|
-
val isMoving = (event.
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
val isMoving = when(event.activityType) {
|
|
26
|
+
DetectedActivity.WALKING,
|
|
27
|
+
DetectedActivity.RUNNING,
|
|
28
|
+
DetectedActivity.ON_BICYCLE,
|
|
29
|
+
DetectedActivity.IN_VEHICLE -> true
|
|
30
|
+
else -> false
|
|
31
|
+
}
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
// --- NEW: DIRECT NATIVE CONTROL (No JS required) ---
|
|
30
34
|
try {
|
|
31
35
|
if (isMoving) {
|
|
32
36
|
// Fast Updates (30s) when moving
|
|
@@ -40,8 +40,8 @@ class LocationHelper(private val context: ReactApplicationContext) {
|
|
|
40
40
|
// -----------------------
|
|
41
41
|
|
|
42
42
|
locationRequest = LocationRequest.create().apply {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
interval = 300000
|
|
44
|
+
fastestInterval = 300000
|
|
45
45
|
priority = Priority.PRIORITY_BALANCED_POWER_ACCURACY
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -36,6 +36,18 @@ class MotionDetector(private val context: ReactApplicationContext) {
|
|
|
36
36
|
ActivityTransition.Builder()
|
|
37
37
|
.setActivityType(DetectedActivity.IN_VEHICLE)
|
|
38
38
|
.setActivityTransition(ActivityTransition.ACTIVITY_TRANSITION_ENTER)
|
|
39
|
+
.build(),
|
|
40
|
+
|
|
41
|
+
// 🟢 ADDED: Detect when user STARTS Running
|
|
42
|
+
ActivityTransition.Builder()
|
|
43
|
+
.setActivityType(DetectedActivity.RUNNING)
|
|
44
|
+
.setActivityTransition(ActivityTransition.ACTIVITY_TRANSITION_ENTER)
|
|
45
|
+
.build(),
|
|
46
|
+
|
|
47
|
+
// 🟢 ADDED: Detect when user STARTS Cycling
|
|
48
|
+
ActivityTransition.Builder()
|
|
49
|
+
.setActivityType(DetectedActivity.ON_BICYCLE)
|
|
50
|
+
.setActivityTransition(ActivityTransition.ACTIVITY_TRANSITION_ENTER)
|
|
39
51
|
.build()
|
|
40
52
|
)
|
|
41
53
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-geo-activity-kit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Battery-efficient location tracking with motion detection and native notifications.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|