@josuelmm/cordova-background-geolocation 4.5.2 → 4.5.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.
Files changed (45) hide show
  1. package/.npmignore +47 -47
  2. package/CHANGELOG.md +8 -0
  3. package/CONTRIBUTORS.md +15 -15
  4. package/LICENSE +191 -191
  5. package/README.md +5 -5
  6. package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/ConfigMapper.java +2 -2
  7. package/android/CDVBackgroundGeolocation/src/main/java/com/tenforwardconsulting/bgloc/cordova/BackgroundGeolocationPlugin.java +1 -1
  8. package/android/common/src/main/AndroidManifest.xml +76 -76
  9. package/android/common/src/main/java/com/marianhello/bgloc/BootCompletedReceiver.java +1 -1
  10. package/android/common/src/main/java/com/marianhello/bgloc/Config.java +6 -6
  11. package/android/common/src/main/java/com/marianhello/bgloc/HttpPostService.java +21 -1
  12. package/android/common/src/main/java/com/marianhello/bgloc/data/ConfigJsonMapper.java +2 -2
  13. package/android/common/src/main/java/com/marianhello/bgloc/data/SessionLocationDAO.java +18 -18
  14. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionContract.java +74 -74
  15. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionLocationDAO.java +169 -169
  16. package/android/common/src/main/java/com/marianhello/bgloc/provider/AbstractLocationProvider.java +4 -4
  17. package/android/common/src/main/java/com/marianhello/bgloc/provider/ActivityRecognitionLocationProvider.java +7 -7
  18. package/android/common/src/main/java/com/marianhello/bgloc/provider/DistanceFilterLocationProvider.java +7 -7
  19. package/android/common/src/main/java/com/marianhello/bgloc/provider/RawLocationProvider.java +5 -5
  20. package/angular/background-geolocation-enums.ts +63 -63
  21. package/angular/background-geolocation-events.ts +38 -38
  22. package/angular/background-geolocation.module.ts +29 -29
  23. package/angular/dist/esm2022/background-geolocation-enums.mjs +1 -1
  24. package/angular/dist/esm2022/background-geolocation-events.mjs +1 -1
  25. package/angular/dist/esm2022/background-geolocation.module.mjs +1 -1
  26. package/angular/dist/fesm2022/josuelmm-cordova-background-geolocation.mjs.map +1 -1
  27. package/angular/tsconfig.json +18 -18
  28. package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.m +1 -1
  29. package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.m +6 -6
  30. package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.m +2 -2
  31. package/ios/common/BackgroundGeolocation/MAURConfig.h +1 -1
  32. package/ios/common/BackgroundGeolocation/MAURConfig.m +2 -2
  33. package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.m +1 -1
  34. package/ios/common/BackgroundGeolocation/MAURLocationManager.m +1 -1
  35. package/ios/common/BackgroundGeolocation/MAURPostLocationTask.m +17 -1
  36. package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.m +1 -1
  37. package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.h +29 -29
  38. package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.m +31 -31
  39. package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.h +25 -25
  40. package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.m +153 -153
  41. package/package.json +1 -1
  42. package/plugin.xml +1 -1
  43. package/www/BackgroundGeolocation.d.ts +4 -4
  44. package/www/cordova-channel-stub.js +27 -27
  45. package/www/cordova-exec-stub.js +15 -15
@@ -1,76 +1,76 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!--
3
- Licensed to the Apache Software Foundation (ASF) under one
4
- or more contributor license agreements. See the NOTICE file
5
- distributed with this work for additional information
6
- regarding copyright ownership. The ASF licenses this file
7
- to you under the Apache License, Version 2.0 (the
8
- "License"); you may not use this file except in compliance
9
- with the License. You may obtain a copy of the License at
10
-
11
- http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- Unless required by applicable law or agreed to in writing,
14
- software distributed under the License is distributed on an
15
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- KIND, either express or implied. See the License for the
17
- specific language governing permissions and limitations
18
- under the License.
19
- -->
20
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
21
- package="com.marianhello.backgroundgeolocation" android:versionName="1.0" android:versionCode="1">
22
- <application>
23
- <service
24
- android:name="com.marianhello.bgloc.sync.SyncService"
25
- android:exported="true"
26
- android:process=":sync">
27
- <intent-filter>
28
- <action android:name="android.content.SyncAdapter"/>
29
- </intent-filter>
30
- <meta-data android:name="android.content.SyncAdapter"
31
- android:resource="@xml/syncadapter"/>
32
- </service>
33
- <service
34
- android:exported="false"
35
- android:name="com.marianhello.bgloc.sync.AuthenticatorService">
36
- <intent-filter>
37
- <action android:name="android.accounts.AccountAuthenticator"/>
38
- </intent-filter>
39
- <meta-data
40
- android:name="android.accounts.AccountAuthenticator"
41
- android:resource="@xml/authenticator" />
42
- </service>
43
- <provider
44
- android:name="com.marianhello.bgloc.data.provider.LocationContentProvider"
45
- android:authorities="@string/plugin_bgloc_content_authority"
46
- android:exported="false"
47
- android:syncable="true"/>
48
- <service
49
- android:enabled="true"
50
- android:exported="false"
51
- android:name="com.marianhello.bgloc.service.LocationServiceImpl"
52
- android:foregroundServiceType="location" />
53
- <receiver android:enabled="true" android:exported="true" android:name="com.marianhello.bgloc.BootCompletedReceiver">
54
- <intent-filter>
55
- <action android:name="android.intent.action.BOOT_COMPLETED" />
56
- </intent-filter>
57
- </receiver>
58
- <uses-library android:name="org.apache.http.legacy" android:required="true" />
59
- </application>
60
-
61
- <uses-feature android:name="android.hardware.location" android:required="false" />
62
- <uses-permission android:name="android.permission.INTERNET"/>
63
- <uses-permission android:name="android.permission.WAKE_LOCK" />
64
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
65
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
66
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
67
- <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
68
- <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
69
- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
70
- <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
71
- <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
72
- <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
73
- <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
74
- <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
75
- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
76
- </manifest>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one
4
+ or more contributor license agreements. See the NOTICE file
5
+ distributed with this work for additional information
6
+ regarding copyright ownership. The ASF licenses this file
7
+ to you under the Apache License, Version 2.0 (the
8
+ "License"); you may not use this file except in compliance
9
+ with the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing,
14
+ software distributed under the License is distributed on an
15
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ KIND, either express or implied. See the License for the
17
+ specific language governing permissions and limitations
18
+ under the License.
19
+ -->
20
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
21
+ package="com.marianhello.backgroundgeolocation" android:versionName="1.0" android:versionCode="1">
22
+ <application>
23
+ <service
24
+ android:name="com.marianhello.bgloc.sync.SyncService"
25
+ android:exported="true"
26
+ android:process=":sync">
27
+ <intent-filter>
28
+ <action android:name="android.content.SyncAdapter"/>
29
+ </intent-filter>
30
+ <meta-data android:name="android.content.SyncAdapter"
31
+ android:resource="@xml/syncadapter"/>
32
+ </service>
33
+ <service
34
+ android:exported="false"
35
+ android:name="com.marianhello.bgloc.sync.AuthenticatorService">
36
+ <intent-filter>
37
+ <action android:name="android.accounts.AccountAuthenticator"/>
38
+ </intent-filter>
39
+ <meta-data
40
+ android:name="android.accounts.AccountAuthenticator"
41
+ android:resource="@xml/authenticator" />
42
+ </service>
43
+ <provider
44
+ android:name="com.marianhello.bgloc.data.provider.LocationContentProvider"
45
+ android:authorities="@string/plugin_bgloc_content_authority"
46
+ android:exported="false"
47
+ android:syncable="true"/>
48
+ <service
49
+ android:enabled="true"
50
+ android:exported="false"
51
+ android:name="com.marianhello.bgloc.service.LocationServiceImpl"
52
+ android:foregroundServiceType="location" />
53
+ <receiver android:enabled="true" android:exported="true" android:name="com.marianhello.bgloc.BootCompletedReceiver">
54
+ <intent-filter>
55
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
56
+ </intent-filter>
57
+ </receiver>
58
+ <uses-library android:name="org.apache.http.legacy" android:required="true" />
59
+ </application>
60
+
61
+ <uses-feature android:name="android.hardware.location" android:required="false" />
62
+ <uses-permission android:name="android.permission.INTERNET"/>
63
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
64
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
65
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
66
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
67
+ <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
68
+ <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
69
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
70
+ <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
71
+ <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
72
+ <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
73
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
74
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
75
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
76
+ </manifest>
@@ -35,7 +35,7 @@ public class BootCompletedReceiver extends BroadcastReceiver {
35
35
  public void onReceive(Context context, Intent intent) {
36
36
  String action = intent != null ? intent.getAction() : null;
37
37
 
38
- // v4.5.2 — hardening: ignore arbitrary broadcasts directed at this
38
+ // v4.5.4 — hardening: ignore arbitrary broadcasts directed at this
39
39
  // receiver. Without this, any explicit intent (e.g. a malicious app
40
40
  // targeting our package) could trigger the service auto-start path.
41
41
  // Accept only the canonical boot/package-replaced actions plus the
@@ -94,7 +94,7 @@ public class Config implements Parcelable
94
94
  private Integer stationaryPollInterval;
95
95
  /** Aggressive poll interval while stationary (ms). Default 60_000. */
96
96
  private Integer stationaryPollFast;
97
- // v4.5.2 — provider hardening
97
+ // v4.5.4 — provider hardening
98
98
  /** 0-100. Activity-recognition transitions below this confidence are ignored. Default 50. */
99
99
  private Integer activityConfidenceThreshold;
100
100
  /** Discard fixes whose `accuracy` (m) is worse than this. `null` (default) disables the filter. */
@@ -281,7 +281,7 @@ public class Config implements Parcelable
281
281
  setStationaryTimeout((Integer) in.readValue(null));
282
282
  setStationaryPollInterval((Integer) in.readValue(null));
283
283
  setStationaryPollFast((Integer) in.readValue(null));
284
- // v4.5.2 provider hardening
284
+ // v4.5.4 provider hardening
285
285
  setActivityConfidenceThreshold((Integer) in.readValue(null));
286
286
  setMaxAcceptedAccuracy((Float) in.readValue(null));
287
287
  // v4.5.1 — pass the plugin's classloader so getSerializable() can deserialize
@@ -338,8 +338,8 @@ public class Config implements Parcelable
338
338
  config.stationaryTimeout = 5 * 60 * 1000;
339
339
  config.stationaryPollInterval = 3 * 60 * 1000;
340
340
  config.stationaryPollFast = 60 * 1000;
341
- config.activityConfidenceThreshold = 50; // v4.5.2: ignore <50% confidence transitions
342
- config.maxAcceptedAccuracy = null; // v4.5.2: off by default (no JS regression)
341
+ config.activityConfidenceThreshold = 50; // v4.5.4: ignore <50% confidence transitions
342
+ config.maxAcceptedAccuracy = null; // v4.5.4: off by default (no JS regression)
343
343
 
344
344
  return config;
345
345
  }
@@ -414,7 +414,7 @@ public class Config implements Parcelable
414
414
  out.writeValue(getStationaryTimeout());
415
415
  out.writeValue(getStationaryPollInterval());
416
416
  out.writeValue(getStationaryPollFast());
417
- // v4.5.2
417
+ // v4.5.4
418
418
  out.writeValue(getActivityConfidenceThreshold());
419
419
  out.writeValue(getMaxAcceptedAccuracy());
420
420
  Bundle bundle = new Bundle();
@@ -1139,7 +1139,7 @@ public class Config implements Parcelable
1139
1139
  if (config2.stationaryTimeout != null) merger.setStationaryTimeout(config2.stationaryTimeout);
1140
1140
  if (config2.stationaryPollInterval != null) merger.setStationaryPollInterval(config2.stationaryPollInterval);
1141
1141
  if (config2.stationaryPollFast != null) merger.setStationaryPollFast(config2.stationaryPollFast);
1142
- // v4.5.2
1142
+ // v4.5.4
1143
1143
  if (config2.activityConfidenceThreshold != null) merger.setActivityConfidenceThreshold(config2.activityConfidenceThreshold);
1144
1144
  if (config2.maxAcceptedAccuracy != null) merger.setMaxAcceptedAccuracy(config2.maxAcceptedAccuracy);
1145
1145
 
@@ -193,7 +193,27 @@ public class HttpPostService {
193
193
  Iterator<String> keys = jsonObj.keys();
194
194
  while (keys.hasNext()) {
195
195
  String key = keys.next();
196
- String value = jsonObj.get(key).toString();
196
+ // v4.5.4: skip null / JSONObject.NULL values. Previously these were
197
+ // serialised as the literal string "null", which servers like Traccar
198
+ // reject (Traccar OsmAndProtocolDecoder throws NumberFormatException
199
+ // on "speed=null"). Placeholders that resolve to no value (@speed,
200
+ // @events, @battery, etc.) end up as JSONObject.NULL in the batch and
201
+ // must be omitted from form-urlencoded bodies. Using `isNull` covers
202
+ // both the reference-equality and the literal "null" string cases.
203
+ if (jsonObj.isNull(key)) {
204
+ continue;
205
+ }
206
+ Object raw = jsonObj.opt(key);
207
+ if (raw == null) {
208
+ continue;
209
+ }
210
+ String value = raw.toString();
211
+ // Extra safety: some pre-parsed objects may stringify to "null"
212
+ // (e.g. NSNull, Boolean nulls from non-strict parsers). Treat the
213
+ // literal "null" string the same as a missing value.
214
+ if ("null".equals(value)) {
215
+ continue;
216
+ }
197
217
  if (result.length() > 0) {
198
218
  result.append("&");
199
219
  }
@@ -71,7 +71,7 @@ public final class ConfigJsonMapper {
71
71
  j.put("stationaryTimeout", c.getStationaryTimeout());
72
72
  j.put("stationaryPollInterval", c.getStationaryPollInterval());
73
73
  j.put("stationaryPollFast", c.getStationaryPollFast());
74
- // v4.5.2: provider hardening knobs
74
+ // v4.5.4: provider hardening knobs
75
75
  j.put("activityConfidenceThreshold", c.getActivityConfidenceThreshold());
76
76
  j.put("maxAcceptedAccuracy", c.getMaxAcceptedAccuracy());
77
77
 
@@ -152,7 +152,7 @@ public final class ConfigJsonMapper {
152
152
  if (j.has("stationaryTimeout") && !j.isNull("stationaryTimeout")) c.setStationaryTimeout(j.getInt("stationaryTimeout"));
153
153
  if (j.has("stationaryPollInterval") && !j.isNull("stationaryPollInterval")) c.setStationaryPollInterval(j.getInt("stationaryPollInterval"));
154
154
  if (j.has("stationaryPollFast") && !j.isNull("stationaryPollFast")) c.setStationaryPollFast(j.getInt("stationaryPollFast"));
155
- // v4.5.2
155
+ // v4.5.4
156
156
  if (j.has("activityConfidenceThreshold") && !j.isNull("activityConfidenceThreshold")) c.setActivityConfidenceThreshold(j.getInt("activityConfidenceThreshold"));
157
157
  if (j.has("maxAcceptedAccuracy") && !j.isNull("maxAcceptedAccuracy")) c.setMaxAcceptedAccuracy((float) j.getDouble("maxAcceptedAccuracy"));
158
158
 
@@ -1,18 +1,18 @@
1
- package com.marianhello.bgloc.data;
2
-
3
- import java.util.Collection;
4
-
5
- /**
6
- * DAO for the current recording session locations.
7
- * Session is independent of sync: locations are kept until startSession() or clearSession().
8
- */
9
- public interface SessionLocationDAO {
10
- /** Clear session table and set session active. Call when user starts a route. */
11
- void startSession();
12
- /** Clear session table and set session inactive. Call when route is finished and sync OK. */
13
- void clearSession();
14
- boolean isSessionActive();
15
- void persistSessionLocation(BackgroundLocation location);
16
- Collection<BackgroundLocation> getSessionLocations();
17
- int getSessionLocationsCount();
18
- }
1
+ package com.marianhello.bgloc.data;
2
+
3
+ import java.util.Collection;
4
+
5
+ /**
6
+ * DAO for the current recording session locations.
7
+ * Session is independent of sync: locations are kept until startSession() or clearSession().
8
+ */
9
+ public interface SessionLocationDAO {
10
+ /** Clear session table and set session active. Call when user starts a route. */
11
+ void startSession();
12
+ /** Clear session table and set session inactive. Call when route is finished and sync OK. */
13
+ void clearSession();
14
+ boolean isSessionActive();
15
+ void persistSessionLocation(BackgroundLocation location);
16
+ Collection<BackgroundLocation> getSessionLocations();
17
+ int getSessionLocationsCount();
18
+ }
@@ -1,74 +1,74 @@
1
- package com.marianhello.bgloc.data.sqlite;
2
-
3
- import android.provider.BaseColumns;
4
-
5
- import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.COMMA_SEP;
6
- import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.INTEGER_TYPE;
7
- import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.REAL_TYPE;
8
- import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.TEXT_TYPE;
9
-
10
- /**
11
- * Contract for the "session" location table.
12
- * Stores all locations for the current recording session (route).
13
- * Cleared on startSession() and clearSession(); not cleared when sync succeeds.
14
- */
15
- public final class SQLiteSessionContract {
16
-
17
- public SQLiteSessionContract() {}
18
-
19
- public static abstract class SessionEntry implements BaseColumns {
20
- public static final String TABLE_NAME = "location_session";
21
- public static final String COLUMN_NAME_NULLABLE = "NULLHACK";
22
- public static final String COLUMN_NAME_TIME = "time";
23
- public static final String COLUMN_NAME_ACCURACY = "accuracy";
24
- public static final String COLUMN_NAME_VERTICAL_ACCURACY = "vertical_accuracy";
25
- public static final String COLUMN_NAME_SPEED = "speed";
26
- public static final String COLUMN_NAME_BEARING = "bearing";
27
- public static final String COLUMN_NAME_ALTITUDE = "altitude";
28
- public static final String COLUMN_NAME_LATITUDE = "latitude";
29
- public static final String COLUMN_NAME_LONGITUDE = "longitude";
30
- public static final String COLUMN_NAME_RADIUS = "radius";
31
- public static final String COLUMN_NAME_HAS_ACCURACY = "has_accuracy";
32
- public static final String COLUMN_NAME_HAS_VERTICAL_ACCURACY = "has_vertical_accuracy";
33
- public static final String COLUMN_NAME_HAS_SPEED = "has_speed";
34
- public static final String COLUMN_NAME_HAS_BEARING = "has_bearing";
35
- public static final String COLUMN_NAME_HAS_ALTITUDE = "has_altitude";
36
- public static final String COLUMN_NAME_HAS_RADIUS = "has_radius";
37
- public static final String COLUMN_NAME_PROVIDER = "provider";
38
- public static final String COLUMN_NAME_LOCATION_PROVIDER = "service_provider";
39
- public static final String COLUMN_NAME_STATUS = "valid";
40
- public static final String COLUMN_NAME_BATCH_START_MILLIS = "batch_start";
41
- public static final String COLUMN_NAME_MOCK_FLAGS = "mock_flags";
42
-
43
- public static final String SQL_CREATE_SESSION_TABLE =
44
- "CREATE TABLE " + SessionEntry.TABLE_NAME + " (" +
45
- SessionEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
46
- SessionEntry.COLUMN_NAME_TIME + INTEGER_TYPE + COMMA_SEP +
47
- SessionEntry.COLUMN_NAME_ACCURACY + REAL_TYPE + COMMA_SEP +
48
- SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY + REAL_TYPE + COMMA_SEP +
49
- SessionEntry.COLUMN_NAME_SPEED + REAL_TYPE + COMMA_SEP +
50
- SessionEntry.COLUMN_NAME_BEARING + REAL_TYPE + COMMA_SEP +
51
- SessionEntry.COLUMN_NAME_ALTITUDE + REAL_TYPE + COMMA_SEP +
52
- SessionEntry.COLUMN_NAME_LATITUDE + REAL_TYPE + COMMA_SEP +
53
- SessionEntry.COLUMN_NAME_LONGITUDE + REAL_TYPE + COMMA_SEP +
54
- SessionEntry.COLUMN_NAME_RADIUS + REAL_TYPE + COMMA_SEP +
55
- SessionEntry.COLUMN_NAME_HAS_ACCURACY + INTEGER_TYPE + COMMA_SEP +
56
- SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY + INTEGER_TYPE + COMMA_SEP +
57
- SessionEntry.COLUMN_NAME_HAS_SPEED + INTEGER_TYPE + COMMA_SEP +
58
- SessionEntry.COLUMN_NAME_HAS_BEARING + INTEGER_TYPE + COMMA_SEP +
59
- SessionEntry.COLUMN_NAME_HAS_ALTITUDE + INTEGER_TYPE + COMMA_SEP +
60
- SessionEntry.COLUMN_NAME_HAS_RADIUS + INTEGER_TYPE + COMMA_SEP +
61
- SessionEntry.COLUMN_NAME_PROVIDER + TEXT_TYPE + COMMA_SEP +
62
- SessionEntry.COLUMN_NAME_LOCATION_PROVIDER + INTEGER_TYPE + COMMA_SEP +
63
- SessionEntry.COLUMN_NAME_STATUS + INTEGER_TYPE + COMMA_SEP +
64
- SessionEntry.COLUMN_NAME_BATCH_START_MILLIS + INTEGER_TYPE + COMMA_SEP +
65
- SessionEntry.COLUMN_NAME_MOCK_FLAGS + INTEGER_TYPE +
66
- " )";
67
-
68
- public static final String SQL_DROP_SESSION_TABLE =
69
- "DROP TABLE IF EXISTS " + SessionEntry.TABLE_NAME;
70
-
71
- public static final String SQL_CREATE_SESSION_TABLE_TIME_IDX =
72
- "CREATE INDEX session_time_idx ON " + SessionEntry.TABLE_NAME + " (" + SessionEntry.COLUMN_NAME_TIME + ")";
73
- }
74
- }
1
+ package com.marianhello.bgloc.data.sqlite;
2
+
3
+ import android.provider.BaseColumns;
4
+
5
+ import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.COMMA_SEP;
6
+ import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.INTEGER_TYPE;
7
+ import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.REAL_TYPE;
8
+ import static com.marianhello.bgloc.data.sqlite.SQLiteOpenHelper.TEXT_TYPE;
9
+
10
+ /**
11
+ * Contract for the "session" location table.
12
+ * Stores all locations for the current recording session (route).
13
+ * Cleared on startSession() and clearSession(); not cleared when sync succeeds.
14
+ */
15
+ public final class SQLiteSessionContract {
16
+
17
+ public SQLiteSessionContract() {}
18
+
19
+ public static abstract class SessionEntry implements BaseColumns {
20
+ public static final String TABLE_NAME = "location_session";
21
+ public static final String COLUMN_NAME_NULLABLE = "NULLHACK";
22
+ public static final String COLUMN_NAME_TIME = "time";
23
+ public static final String COLUMN_NAME_ACCURACY = "accuracy";
24
+ public static final String COLUMN_NAME_VERTICAL_ACCURACY = "vertical_accuracy";
25
+ public static final String COLUMN_NAME_SPEED = "speed";
26
+ public static final String COLUMN_NAME_BEARING = "bearing";
27
+ public static final String COLUMN_NAME_ALTITUDE = "altitude";
28
+ public static final String COLUMN_NAME_LATITUDE = "latitude";
29
+ public static final String COLUMN_NAME_LONGITUDE = "longitude";
30
+ public static final String COLUMN_NAME_RADIUS = "radius";
31
+ public static final String COLUMN_NAME_HAS_ACCURACY = "has_accuracy";
32
+ public static final String COLUMN_NAME_HAS_VERTICAL_ACCURACY = "has_vertical_accuracy";
33
+ public static final String COLUMN_NAME_HAS_SPEED = "has_speed";
34
+ public static final String COLUMN_NAME_HAS_BEARING = "has_bearing";
35
+ public static final String COLUMN_NAME_HAS_ALTITUDE = "has_altitude";
36
+ public static final String COLUMN_NAME_HAS_RADIUS = "has_radius";
37
+ public static final String COLUMN_NAME_PROVIDER = "provider";
38
+ public static final String COLUMN_NAME_LOCATION_PROVIDER = "service_provider";
39
+ public static final String COLUMN_NAME_STATUS = "valid";
40
+ public static final String COLUMN_NAME_BATCH_START_MILLIS = "batch_start";
41
+ public static final String COLUMN_NAME_MOCK_FLAGS = "mock_flags";
42
+
43
+ public static final String SQL_CREATE_SESSION_TABLE =
44
+ "CREATE TABLE " + SessionEntry.TABLE_NAME + " (" +
45
+ SessionEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
46
+ SessionEntry.COLUMN_NAME_TIME + INTEGER_TYPE + COMMA_SEP +
47
+ SessionEntry.COLUMN_NAME_ACCURACY + REAL_TYPE + COMMA_SEP +
48
+ SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY + REAL_TYPE + COMMA_SEP +
49
+ SessionEntry.COLUMN_NAME_SPEED + REAL_TYPE + COMMA_SEP +
50
+ SessionEntry.COLUMN_NAME_BEARING + REAL_TYPE + COMMA_SEP +
51
+ SessionEntry.COLUMN_NAME_ALTITUDE + REAL_TYPE + COMMA_SEP +
52
+ SessionEntry.COLUMN_NAME_LATITUDE + REAL_TYPE + COMMA_SEP +
53
+ SessionEntry.COLUMN_NAME_LONGITUDE + REAL_TYPE + COMMA_SEP +
54
+ SessionEntry.COLUMN_NAME_RADIUS + REAL_TYPE + COMMA_SEP +
55
+ SessionEntry.COLUMN_NAME_HAS_ACCURACY + INTEGER_TYPE + COMMA_SEP +
56
+ SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY + INTEGER_TYPE + COMMA_SEP +
57
+ SessionEntry.COLUMN_NAME_HAS_SPEED + INTEGER_TYPE + COMMA_SEP +
58
+ SessionEntry.COLUMN_NAME_HAS_BEARING + INTEGER_TYPE + COMMA_SEP +
59
+ SessionEntry.COLUMN_NAME_HAS_ALTITUDE + INTEGER_TYPE + COMMA_SEP +
60
+ SessionEntry.COLUMN_NAME_HAS_RADIUS + INTEGER_TYPE + COMMA_SEP +
61
+ SessionEntry.COLUMN_NAME_PROVIDER + TEXT_TYPE + COMMA_SEP +
62
+ SessionEntry.COLUMN_NAME_LOCATION_PROVIDER + INTEGER_TYPE + COMMA_SEP +
63
+ SessionEntry.COLUMN_NAME_STATUS + INTEGER_TYPE + COMMA_SEP +
64
+ SessionEntry.COLUMN_NAME_BATCH_START_MILLIS + INTEGER_TYPE + COMMA_SEP +
65
+ SessionEntry.COLUMN_NAME_MOCK_FLAGS + INTEGER_TYPE +
66
+ " )";
67
+
68
+ public static final String SQL_DROP_SESSION_TABLE =
69
+ "DROP TABLE IF EXISTS " + SessionEntry.TABLE_NAME;
70
+
71
+ public static final String SQL_CREATE_SESSION_TABLE_TIME_IDX =
72
+ "CREATE INDEX session_time_idx ON " + SessionEntry.TABLE_NAME + " (" + SessionEntry.COLUMN_NAME_TIME + ")";
73
+ }
74
+ }