react-native-geo-activity-kit 2.0.6 → 3.0.1

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.
@@ -50,12 +50,14 @@ class SensorModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
50
50
  // --- SERVICE CONTROL ---
51
51
 
52
52
  @ReactMethod
53
- fun startForegroundService(title: String, body: String, promise: Promise) {
53
+ // ADD "id: Int" here. Now it matches JavaScript's 3 arguments.
54
+ fun startForegroundService(title: String, body: String, id: Int, promise: Promise) {
54
55
  try {
55
56
  val intent = Intent(reactApplicationContext, TrackingService::class.java)
56
57
  intent.action = TrackingService.ACTION_START
57
58
  intent.putExtra("title", title)
58
59
  intent.putExtra("body", body)
60
+ // intent.putExtra("id", id) // Optional: Pass it if you want to use it later
59
61
 
60
62
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
61
63
  reactApplicationContext.startForegroundService(intent)
@@ -7,34 +7,32 @@ const LINKING_ERROR = `The package 'react-native-geo-activity-kit' doesn't seem
7
7
  ios: "- You have run 'pod install'\n",
8
8
  default: ''
9
9
  }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
10
-
11
- // 1. Point to the CORRECT Native Module Name
12
- const GeoActivityKit = NativeModules.GeoActivityKit ? NativeModules.RNSensorModule : new Proxy({}, {
10
+ const RNSensorModule = NativeModules.RNSensorModule ? NativeModules.RNSensorModule : new Proxy({}, {
13
11
  get() {
14
12
  throw new Error(LINKING_ERROR);
15
13
  }
16
14
  });
17
- const emitter = new NativeEventEmitter(GeoActivityKit);
15
+ const emitter = new NativeEventEmitter(RNSensorModule);
18
16
 
19
17
  // 2. Define Types
20
18
 
21
19
  // 3. Export the Object
22
20
  export default {
23
21
  // --- Service Control ---
24
- startForegroundService: (title, body, id) => GeoActivityKit.startForegroundService(title, body, id),
25
- stopForegroundService: () => GeoActivityKit.stopForegroundService(),
26
- updateServiceNotification: (title, body) => GeoActivityKit.updateServiceNotification(title, body),
22
+ startForegroundService: (title, body, id) => RNSensorModule.startForegroundService(title, body, id),
23
+ stopForegroundService: () => RNSensorModule.stopForegroundService(),
24
+ updateServiceNotification: (title, body) => RNSensorModule.updateServiceNotification(title, body),
27
25
  // --- Motion & Intelligence ---
28
- startMotionDetector: (confidence = 75) => GeoActivityKit.startMotionDetector(confidence),
29
- stopMotionDetector: () => GeoActivityKit.stopMotionDetector(),
26
+ startMotionDetector: (confidence = 75) => RNSensorModule.startMotionDetector(confidence),
27
+ stopMotionDetector: () => RNSensorModule.stopMotionDetector(),
30
28
  // --- Location Control ---
31
- setLocationUpdateInterval: ms => GeoActivityKit.setLocationUpdateInterval(ms),
29
+ setLocationUpdateInterval: ms => RNSensorModule.setLocationUpdateInterval(ms),
32
30
  // --- Alerts & Notifications ---
33
- fireGeofenceAlert: (type, userName) => GeoActivityKit.fireGeofenceAlert(type, userName),
34
- fireGenericAlert: (title, body, id) => GeoActivityKit.fireGenericAlert(title, body, id),
35
- cancelGenericAlert: id => GeoActivityKit.cancelGenericAlert(id),
31
+ fireGeofenceAlert: (type, userName) => RNSensorModule.fireGeofenceAlert(type, userName),
32
+ fireGenericAlert: (title, body, id) => RNSensorModule.fireGenericAlert(title, body, id),
33
+ cancelGenericAlert: id => RNSensorModule.cancelGenericAlert(id),
36
34
  // --- GPS Status ---
37
- registerGpsListener: () => GeoActivityKit.registerGpsListener(),
35
+ registerGpsListener: () => RNSensorModule.registerGpsListener(),
38
36
  // --- Event Listeners ---
39
37
  // Note: We cast event to 'any' to avoid TS strict object checks,
40
38
  // and return EventSubscription (modern) instead of EmitterSubscription (deprecated).
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","GeoActivityKit","RNSensorModule","Proxy","get","Error","emitter","startForegroundService","title","body","id","stopForegroundService","updateServiceNotification","startMotionDetector","confidence","stopMotionDetector","setLocationUpdateInterval","ms","fireGeofenceAlert","type","userName","fireGenericAlert","cancelGenericAlert","registerGpsListener","addGpsStatusListener","cb","addListener","event","addMotionListener","addLocationLogListener","addLocationErrorListener"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AACnB;;AAEvD,MAAMC,aAAa,GACjB,wFAAwF,GACxFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,cAAc,GAAGP,aAAa,CAACO,cAAc,GAC/CP,aAAa,CAACQ,cAAc,GAC5B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMS,OAAO,GAAG,IAAIX,kBAAkB,CAACM,cAAc,CAAC;;AAEtD;;AAoBA;AACA,eAAe;EACb;EACAM,sBAAsB,EAAEA,CAACC,KAAa,EAAEC,IAAY,EAAEC,EAAU,KAC9DT,cAAc,CAACM,sBAAsB,CAACC,KAAK,EAAEC,IAAI,EAAEC,EAAE,CAAC;EAExDC,qBAAqB,EAAEA,CAAA,KACrBV,cAAc,CAACU,qBAAqB,CAAC,CAAC;EAExCC,yBAAyB,EAAEA,CAACJ,KAAa,EAAEC,IAAY,KACrDR,cAAc,CAACW,yBAAyB,CAACJ,KAAK,EAAEC,IAAI,CAAC;EAEvD;EACAI,mBAAmB,EAAEA,CAACC,UAAkB,GAAG,EAAE,KAC3Cb,cAAc,CAACY,mBAAmB,CAACC,UAAU,CAAC;EAEhDC,kBAAkB,EAAEA,CAAA,KAClBd,cAAc,CAACc,kBAAkB,CAAC,CAAC;EAErC;EACAC,yBAAyB,EAAGC,EAAU,IACpChB,cAAc,CAACe,yBAAyB,CAACC,EAAE,CAAC;EAE9C;EACAC,iBAAiB,EAAEA,CAACC,IAAkB,EAAEC,QAAgB,KACtDnB,cAAc,CAACiB,iBAAiB,CAACC,IAAI,EAAEC,QAAQ,CAAC;EAElDC,gBAAgB,EAAEA,CAACb,KAAa,EAAEC,IAAY,EAAEC,EAAU,KACxDT,cAAc,CAACoB,gBAAgB,CAACb,KAAK,EAAEC,IAAI,EAAEC,EAAE,CAAC;EAElDY,kBAAkB,EAAGZ,EAAU,IAC7BT,cAAc,CAACqB,kBAAkB,CAACZ,EAAE,CAAC;EAEvC;EACAa,mBAAmB,EAAEA,CAAA,KACnBtB,cAAc,CAACsB,mBAAmB,CAAC,CAAC;EAEtC;EACA;EACA;;EAEAC,oBAAoB,EAAGC,EAAyC,IAC9DnB,OAAO,CAACoB,WAAW,CAAC,oBAAoB,EAAGC,KAAU,IAAKF,EAAE,CAACE,KAAK,CAAC,CAAC;EAEtEC,iBAAiB,EAAGH,EAAgC,IAClDnB,OAAO,CAACoB,WAAW,CAAC,sBAAsB,EAAGC,KAAU,IAAKF,EAAE,CAACE,KAAK,CAAC,CAAC;EAExEE,sBAAsB,EAAGJ,EAAkC,IACzDnB,OAAO,CAACoB,WAAW,CAAC,eAAe,EAAGC,KAAU,IAAKF,EAAE,CAACE,KAAK,CAAC,CAAC;EAEjEG,wBAAwB,EAAGL,EAA+B,IACxDnB,OAAO,CAACoB,WAAW,CAAC,iBAAiB,EAAGC,KAAU,IAAKF,EAAE,CAACE,KAAK,CAAC;AACpE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","RNSensorModule","Proxy","get","Error","emitter","startForegroundService","title","body","id","stopForegroundService","updateServiceNotification","startMotionDetector","confidence","stopMotionDetector","setLocationUpdateInterval","ms","fireGeofenceAlert","type","userName","fireGenericAlert","cancelGenericAlert","registerGpsListener","addGpsStatusListener","cb","addListener","event","addMotionListener","addLocationLogListener","addLocationErrorListener"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SA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,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;IACpF,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,QAAQ,GAAG,YAAY,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;;oCAKiC,MAAM,QAAQ,MAAM,MAAM,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;iCAGxD,OAAO,CAAC,OAAO,CAAC;uCAGR,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;uCAIxC,MAAM,KAAQ,OAAO,CAAC,OAAO,CAAC;8BAGxC,OAAO,CAAC,OAAO,CAAC;oCAIR,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;8BAI5B,IAAI,GAAG,KAAK,YAAY,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;8BAGjD,MAAM,QAAQ,MAAM,MAAM,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;6BAGpD,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;+BAIzB,OAAO,CAAC,OAAO,CAAC;+BAOd,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,KAAG,iBAAiB;4BAG5D,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,KAAG,iBAAiB;iCAG3C,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAG,iBAAiB;mCAGhD,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,KAAG,iBAAiB;;AAjDhF,wBAmDE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-geo-activity-kit",
3
- "version": "2.0.6",
3
+ "version": "3.0.1",
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",
package/src/index.tsx CHANGED
@@ -7,19 +7,18 @@ const LINKING_ERROR =
7
7
  '- You rebuilt the app after installing the package\n' +
8
8
  '- You are not using Expo Go\n';
9
9
 
10
- // 1. Point to the CORRECT Native Module Name
11
- const GeoActivityKit = NativeModules.GeoActivityKit
10
+ const RNSensorModule = NativeModules.RNSensorModule
12
11
  ? NativeModules.RNSensorModule
13
12
  : new Proxy(
14
- {},
15
- {
16
- get() {
17
- throw new Error(LINKING_ERROR);
18
- },
19
- }
20
- );
13
+ {},
14
+ {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ },
18
+ }
19
+ );
21
20
 
22
- const emitter = new NativeEventEmitter(GeoActivityKit);
21
+ const emitter = new NativeEventEmitter(RNSensorModule);
23
22
 
24
23
  // 2. Define Types
25
24
  export interface LocationEvent {
@@ -45,43 +44,43 @@ export interface ErrorEvent {
45
44
  export default {
46
45
  // --- Service Control ---
47
46
  startForegroundService: (title: string, body: string, id: number): Promise<boolean> =>
48
- GeoActivityKit.startForegroundService(title, body, id),
47
+ RNSensorModule.startForegroundService(title, body, id),
49
48
 
50
49
  stopForegroundService: (): Promise<boolean> =>
51
- GeoActivityKit.stopForegroundService(),
50
+ RNSensorModule.stopForegroundService(),
52
51
 
53
52
  updateServiceNotification: (title: string, body: string): Promise<boolean> =>
54
- GeoActivityKit.updateServiceNotification(title, body),
53
+ RNSensorModule.updateServiceNotification(title, body),
55
54
 
56
55
  // --- Motion & Intelligence ---
57
56
  startMotionDetector: (confidence: number = 75): Promise<boolean> =>
58
- GeoActivityKit.startMotionDetector(confidence),
57
+ RNSensorModule.startMotionDetector(confidence),
59
58
 
60
59
  stopMotionDetector: (): Promise<boolean> =>
61
- GeoActivityKit.stopMotionDetector(),
60
+ RNSensorModule.stopMotionDetector(),
62
61
 
63
62
  // --- Location Control ---
64
63
  setLocationUpdateInterval: (ms: number): Promise<void> =>
65
- GeoActivityKit.setLocationUpdateInterval(ms),
64
+ RNSensorModule.setLocationUpdateInterval(ms),
66
65
 
67
66
  // --- Alerts & Notifications ---
68
67
  fireGeofenceAlert: (type: 'IN' | 'OUT', userName: string): Promise<boolean> =>
69
- GeoActivityKit.fireGeofenceAlert(type, userName),
68
+ RNSensorModule.fireGeofenceAlert(type, userName),
70
69
 
71
70
  fireGenericAlert: (title: string, body: string, id: number): Promise<boolean> =>
72
- GeoActivityKit.fireGenericAlert(title, body, id),
71
+ RNSensorModule.fireGenericAlert(title, body, id),
73
72
 
74
73
  cancelGenericAlert: (id: number): Promise<boolean> =>
75
- GeoActivityKit.cancelGenericAlert(id),
74
+ RNSensorModule.cancelGenericAlert(id),
76
75
 
77
76
  // --- GPS Status ---
78
77
  registerGpsListener: (): Promise<boolean> =>
79
- GeoActivityKit.registerGpsListener(),
78
+ RNSensorModule.registerGpsListener(),
80
79
 
81
80
  // --- Event Listeners ---
82
81
  // Note: We cast event to 'any' to avoid TS strict object checks,
83
82
  // and return EventSubscription (modern) instead of EmitterSubscription (deprecated).
84
-
83
+
85
84
  addGpsStatusListener: (cb: (event: { enabled: boolean }) => void): EventSubscription =>
86
85
  emitter.addListener('onGpsStatusChanged', (event: any) => cb(event)),
87
86