@josuelmm/cordova-background-geolocation 4.5.4 → 4.5.5

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/CDVBackgroundGeolocation/src/main/java/com/tenforwardconsulting/bgloc/cordova/BackgroundGeolocationPlugin.java +1 -1
  3. package/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java +7 -0
  4. package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.m +1 -1
  5. package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.h +0 -0
  6. package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.m +0 -0
  7. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager+Internal.h +0 -0
  8. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.h +0 -0
  9. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.m +0 -0
  10. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.h +0 -0
  11. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.m +0 -0
  12. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequestDefines.h +0 -0
  13. package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.h +0 -0
  14. package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.m +0 -0
  15. package/ios/common/BackgroundGeolocation/MAURLocation.m +7 -0
  16. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/README.md +0 -0
  17. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.h +0 -0
  18. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.m +0 -0
  19. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlDataManipulationCommand.h +0 -0
  20. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.h +0 -0
  21. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.m +0 -0
  22. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.h +0 -0
  23. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.m +0 -0
  24. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlStatement.h +0 -0
  25. package/package.json +1 -1
  26. package/plugin.xml +1 -1
  27. package/www/BackgroundGeolocation.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.5.5](https://github.com/josuelmm/cordova-background-geolocation/tree/4.5.5) (2026-06-05)
4
+
5
+ ### Added — `@time_seconds` placeholder
6
+ - Nuevo placeholder `@time_seconds` que resuelve al UTC Unix epoch en **segundos** (10 dígitos), no en milisegundos.
7
+ - **Motivación**: Traccar (protocolo OsmAnd) y varios decoders parsean `timestamp` como segundos. Cuando reciben 13 dígitos (milisegundos) lo intentan parsear como año-58390, lo descartan silenciosamente y **caen al server time**. Sin esto, locations sincronizadas offline llegaban con timestamp del momento del sync en lugar del momento del fix GPS — el path en el mapa parecía "comprimido" porque todos los records compartían hora.
8
+ - **Uso para Traccar**:
9
+ ```js
10
+ postTemplate: {
11
+ lat: '@latitude',
12
+ lon: '@longitude',
13
+ timestamp: '@time_seconds', // ← en lugar de @time
14
+ speed: '@speed',
15
+ accuracy: '@accuracy'
16
+ }
17
+ ```
18
+ - Backends que quieren ISO 8601 pueden usar `@timestamp_iso` (ya existía).
19
+ - Backends que esperan ms (genéricos JSON, Firebase) siguen con `@time`.
20
+
3
21
  ## [4.5.4](https://github.com/josuelmm/cordova-background-geolocation/tree/4.5.4) (2026-05-13)
4
22
 
5
23
  ### Fixed (BLOQUEANTE — sync HTTP 400 con servidores tipo Traccar)
@@ -96,7 +96,7 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Plugin
96
96
  public static final String ACTION_REQUEST_NOTIFICATION_PERMISSION = "requestNotificationPermission";
97
97
 
98
98
  /** Plugin version; keep in sync with plugin.xml. */
99
- public static final String PLUGIN_VERSION = "4.5.4";
99
+ public static final String PLUGIN_VERSION = "4.5.5";
100
100
 
101
101
  private BackgroundGeolocationFacade facade;
102
102
 
@@ -1041,6 +1041,13 @@ public class BackgroundLocation implements Parcelable {
1041
1041
  if ("@time".equals(key)) {
1042
1042
  return time;
1043
1043
  }
1044
+ // v4.5.4 — Unix epoch in SECONDS (not ms). Useful for Traccar OsmAnd
1045
+ // protocol and other backends whose decoders treat 13-digit values as
1046
+ // year-58390 garbage and silently fall back to server time, dropping the
1047
+ // real GPS fix time.
1048
+ if ("@time_seconds".equals(key)) {
1049
+ return time > 0 ? (time / 1000L) : JSONObject.NULL;
1050
+ }
1044
1051
  if ("@latitude".equals(key)) {
1045
1052
  return latitude;
1046
1053
  }
@@ -535,7 +535,7 @@ static NSString * const TAG = @"CDVBackgroundGeolocation";
535
535
  - (void) getPluginVersion:(CDVInvokedUrlCommand*)command
536
536
  {
537
537
  NSLog(@"%@ #%@", TAG, @"getPluginVersion");
538
- NSString *version = @"4.5.4"; // keep in sync with plugin.xml and Android PLUGIN_VERSION
538
+ NSString *version = @"4.5.5"; // keep in sync with plugin.xml and Android PLUGIN_VERSION
539
539
  CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:version];
540
540
  [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
541
541
  }
@@ -205,6 +205,13 @@ enum {
205
205
  if ([key isEqualToString:@"@time"]) {
206
206
  return [NSNumber numberWithDouble:([time timeIntervalSince1970] * 1000)];
207
207
  }
208
+ // v4.5.4 — Unix epoch in SECONDS (not ms). Useful for Traccar OsmAnd
209
+ // protocol and backends that treat 13-digit millis as garbage and silently
210
+ // fall back to server time, dropping the real GPS fix time.
211
+ if ([key isEqualToString:@"@time_seconds"]) {
212
+ if (time == nil) return [NSNull null];
213
+ return [NSNumber numberWithLongLong:(long long)[time timeIntervalSince1970]];
214
+ }
208
215
  if ([key isEqualToString:@"@accuracy"]) {
209
216
  return accuracy;
210
217
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@josuelmm/cordova-background-geolocation",
3
- "version": "4.5.4",
3
+ "version": "4.5.5",
4
4
  "description": "Cordova Background Geolocation (fork actualizado)",
5
5
  "main": "./www/BackgroundGeolocation.js",
6
6
  "types": "./www/BackgroundGeolocation.d.ts",
package/plugin.xml CHANGED
@@ -2,7 +2,7 @@
2
2
  <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
3
3
  xmlns:android="http://schemas.android.com/apk/res/android"
4
4
  id="cordova-background-geolocation"
5
- version="4.5.4">
5
+ version="4.5.5">
6
6
  <name>cordova-background-geolocation</name>
7
7
  <description>Cordova Background Geolocation Plugin</description>
8
8
  <license>Apache-2.0</license>
File without changes