@josuelmm/cordova-background-geolocation 4.5.2 → 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 (66) hide show
  1. package/.npmignore +47 -47
  2. package/CHANGELOG.md +26 -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/BackgroundLocation.java +7 -0
  13. package/android/common/src/main/java/com/marianhello/bgloc/data/ConfigJsonMapper.java +2 -2
  14. package/android/common/src/main/java/com/marianhello/bgloc/data/SessionLocationDAO.java +18 -18
  15. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionContract.java +74 -74
  16. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionLocationDAO.java +169 -169
  17. package/android/common/src/main/java/com/marianhello/bgloc/provider/AbstractLocationProvider.java +4 -4
  18. package/android/common/src/main/java/com/marianhello/bgloc/provider/ActivityRecognitionLocationProvider.java +7 -7
  19. package/android/common/src/main/java/com/marianhello/bgloc/provider/DistanceFilterLocationProvider.java +7 -7
  20. package/android/common/src/main/java/com/marianhello/bgloc/provider/RawLocationProvider.java +5 -5
  21. package/angular/background-geolocation-enums.ts +63 -63
  22. package/angular/background-geolocation-events.ts +38 -38
  23. package/angular/background-geolocation.module.ts +29 -29
  24. package/angular/dist/esm2022/background-geolocation-enums.mjs +1 -1
  25. package/angular/dist/esm2022/background-geolocation-events.mjs +1 -1
  26. package/angular/dist/esm2022/background-geolocation.module.mjs +1 -1
  27. package/angular/dist/fesm2022/josuelmm-cordova-background-geolocation.mjs.map +1 -1
  28. package/angular/tsconfig.json +18 -18
  29. package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.m +1 -1
  30. package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.h +0 -0
  31. package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.m +0 -0
  32. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager+Internal.h +0 -0
  33. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.h +0 -0
  34. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.m +0 -0
  35. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.h +0 -0
  36. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.m +0 -0
  37. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequestDefines.h +0 -0
  38. package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.h +0 -0
  39. package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.m +0 -0
  40. package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.m +6 -6
  41. package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.m +2 -2
  42. package/ios/common/BackgroundGeolocation/MAURConfig.h +1 -1
  43. package/ios/common/BackgroundGeolocation/MAURConfig.m +2 -2
  44. package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.m +1 -1
  45. package/ios/common/BackgroundGeolocation/MAURLocation.m +7 -0
  46. package/ios/common/BackgroundGeolocation/MAURLocationManager.m +1 -1
  47. package/ios/common/BackgroundGeolocation/MAURPostLocationTask.m +17 -1
  48. package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.m +1 -1
  49. package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.h +29 -29
  50. package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.m +31 -31
  51. package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.h +25 -25
  52. package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.m +153 -153
  53. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/README.md +0 -0
  54. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.h +0 -0
  55. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.m +0 -0
  56. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlDataManipulationCommand.h +0 -0
  57. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.h +0 -0
  58. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.m +0 -0
  59. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.h +0 -0
  60. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.m +0 -0
  61. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlStatement.h +0 -0
  62. package/package.json +1 -1
  63. package/plugin.xml +1 -1
  64. package/www/BackgroundGeolocation.d.ts +4 -4
  65. package/www/cordova-channel-stub.js +27 -27
  66. package/www/cordova-exec-stub.js +15 -15
@@ -1,169 +1,169 @@
1
- package com.marianhello.bgloc.data.sqlite;
2
-
3
- import android.content.ContentValues;
4
- import android.content.Context;
5
- import android.database.Cursor;
6
- import android.database.sqlite.SQLiteDatabase;
7
- import com.marianhello.bgloc.data.BackgroundLocation;
8
- import com.marianhello.bgloc.data.SessionLocationDAO;
9
-
10
- import java.util.ArrayList;
11
- import java.util.Collection;
12
-
13
- public class SQLiteSessionLocationDAO implements SessionLocationDAO {
14
-
15
- private static final String PREFS_NAME = "bgloc_session";
16
- private static final String KEY_SESSION_ACTIVE = "session_active";
17
-
18
- private final SQLiteDatabase db;
19
- private final Context context;
20
-
21
- public SQLiteSessionLocationDAO(Context context) {
22
- this.context = context.getApplicationContext();
23
- SQLiteOpenHelper helper = SQLiteOpenHelper.getHelper(this.context);
24
- this.db = helper.getWritableDatabase();
25
- }
26
-
27
- @Override
28
- public void startSession() {
29
- db.delete(SQLiteSessionContract.SessionEntry.TABLE_NAME, null, null);
30
- setSessionActive(true);
31
- }
32
-
33
- @Override
34
- public void clearSession() {
35
- db.delete(SQLiteSessionContract.SessionEntry.TABLE_NAME, null, null);
36
- setSessionActive(false);
37
- }
38
-
39
- @Override
40
- public boolean isSessionActive() {
41
- return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
42
- .getBoolean(KEY_SESSION_ACTIVE, false);
43
- }
44
-
45
- private void setSessionActive(boolean active) {
46
- context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
47
- .edit()
48
- .putBoolean(KEY_SESSION_ACTIVE, active)
49
- .apply();
50
- }
51
-
52
- @Override
53
- public void persistSessionLocation(BackgroundLocation location) {
54
- if (!isSessionActive() || location == null) return;
55
- ContentValues values = getContentValues(location);
56
- db.insertOrThrow(SQLiteSessionContract.SessionEntry.TABLE_NAME,
57
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_NULLABLE, values);
58
- }
59
-
60
- @Override
61
- public Collection<BackgroundLocation> getSessionLocations() {
62
- Collection<BackgroundLocation> locations = new ArrayList<>();
63
- String orderBy = SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME + " ASC";
64
- Cursor cursor = null;
65
- try {
66
- cursor = db.query(
67
- SQLiteSessionContract.SessionEntry.TABLE_NAME,
68
- queryColumns(),
69
- null, null, null, null, orderBy);
70
- while (cursor.moveToNext()) {
71
- locations.add(hydrate(cursor));
72
- }
73
- } finally {
74
- if (cursor != null) cursor.close();
75
- }
76
- return locations;
77
- }
78
-
79
- @Override
80
- public int getSessionLocationsCount() {
81
- Cursor cursor = null;
82
- try {
83
- cursor = db.rawQuery("SELECT COUNT(*) FROM " + SQLiteSessionContract.SessionEntry.TABLE_NAME, null);
84
- return cursor.moveToFirst() ? cursor.getInt(0) : 0;
85
- } finally {
86
- if (cursor != null) cursor.close();
87
- }
88
- }
89
-
90
- private BackgroundLocation hydrate(Cursor c) {
91
- BackgroundLocation l = new BackgroundLocation(c.getString(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_PROVIDER)));
92
- l.setTime(c.getLong(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME)));
93
- if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ACCURACY)) == 1) {
94
- l.setAccuracy(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ACCURACY)));
95
- }
96
- if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY)) == 1) {
97
- l.setVerticalAccuracy(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY)));
98
- }
99
- if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_SPEED)) == 1) {
100
- l.setSpeed(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_SPEED)));
101
- }
102
- if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_BEARING)) == 1) {
103
- l.setBearing(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_BEARING)));
104
- }
105
- if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ALTITUDE)) == 1) {
106
- l.setAltitude(c.getDouble(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ALTITUDE)));
107
- }
108
- if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_RADIUS)) == 1) {
109
- l.setRadius(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_RADIUS)));
110
- }
111
- l.setLatitude(c.getDouble(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LATITUDE)));
112
- l.setLongitude(c.getDouble(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LONGITUDE)));
113
- l.setLocationProvider(c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LOCATION_PROVIDER)));
114
- l.setLocationId(c.getLong(c.getColumnIndex(SQLiteSessionContract.SessionEntry._ID)));
115
- l.setMockFlags(c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_MOCK_FLAGS)));
116
- return l;
117
- }
118
-
119
- private ContentValues getContentValues(BackgroundLocation l) {
120
- ContentValues values = new ContentValues();
121
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_PROVIDER, l.getProvider());
122
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME, l.getTime());
123
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ACCURACY, l.getAccuracy());
124
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY, l.getVerticalAccuracy());
125
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_SPEED, l.getSpeed());
126
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_BEARING, l.getBearing());
127
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ALTITUDE, l.getAltitude());
128
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_RADIUS, l.getRadius());
129
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LATITUDE, l.getLatitude());
130
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LONGITUDE, l.getLongitude());
131
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ACCURACY, l.hasAccuracy() ? 1 : 0);
132
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY, l.hasVerticalAccuracy() ? 1 : 0);
133
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_SPEED, l.hasSpeed() ? 1 : 0);
134
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_BEARING, l.hasBearing() ? 1 : 0);
135
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ALTITUDE, l.hasAltitude() ? 1 : 0);
136
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_RADIUS, l.hasRadius() ? 1 : 0);
137
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LOCATION_PROVIDER, l.getLocationProvider());
138
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_STATUS, 0);
139
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_BATCH_START_MILLIS, 0L);
140
- values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_MOCK_FLAGS, l.getMockFlags());
141
- return values;
142
- }
143
-
144
- private String[] queryColumns() {
145
- return new String[]{
146
- SQLiteSessionContract.SessionEntry._ID,
147
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_PROVIDER,
148
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME,
149
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_ACCURACY,
150
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY,
151
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_SPEED,
152
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_BEARING,
153
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_ALTITUDE,
154
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_RADIUS,
155
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_LATITUDE,
156
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_LONGITUDE,
157
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ACCURACY,
158
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY,
159
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_SPEED,
160
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_BEARING,
161
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ALTITUDE,
162
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_RADIUS,
163
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_LOCATION_PROVIDER,
164
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_STATUS,
165
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_BATCH_START_MILLIS,
166
- SQLiteSessionContract.SessionEntry.COLUMN_NAME_MOCK_FLAGS
167
- };
168
- }
169
- }
1
+ package com.marianhello.bgloc.data.sqlite;
2
+
3
+ import android.content.ContentValues;
4
+ import android.content.Context;
5
+ import android.database.Cursor;
6
+ import android.database.sqlite.SQLiteDatabase;
7
+ import com.marianhello.bgloc.data.BackgroundLocation;
8
+ import com.marianhello.bgloc.data.SessionLocationDAO;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collection;
12
+
13
+ public class SQLiteSessionLocationDAO implements SessionLocationDAO {
14
+
15
+ private static final String PREFS_NAME = "bgloc_session";
16
+ private static final String KEY_SESSION_ACTIVE = "session_active";
17
+
18
+ private final SQLiteDatabase db;
19
+ private final Context context;
20
+
21
+ public SQLiteSessionLocationDAO(Context context) {
22
+ this.context = context.getApplicationContext();
23
+ SQLiteOpenHelper helper = SQLiteOpenHelper.getHelper(this.context);
24
+ this.db = helper.getWritableDatabase();
25
+ }
26
+
27
+ @Override
28
+ public void startSession() {
29
+ db.delete(SQLiteSessionContract.SessionEntry.TABLE_NAME, null, null);
30
+ setSessionActive(true);
31
+ }
32
+
33
+ @Override
34
+ public void clearSession() {
35
+ db.delete(SQLiteSessionContract.SessionEntry.TABLE_NAME, null, null);
36
+ setSessionActive(false);
37
+ }
38
+
39
+ @Override
40
+ public boolean isSessionActive() {
41
+ return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
42
+ .getBoolean(KEY_SESSION_ACTIVE, false);
43
+ }
44
+
45
+ private void setSessionActive(boolean active) {
46
+ context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
47
+ .edit()
48
+ .putBoolean(KEY_SESSION_ACTIVE, active)
49
+ .apply();
50
+ }
51
+
52
+ @Override
53
+ public void persistSessionLocation(BackgroundLocation location) {
54
+ if (!isSessionActive() || location == null) return;
55
+ ContentValues values = getContentValues(location);
56
+ db.insertOrThrow(SQLiteSessionContract.SessionEntry.TABLE_NAME,
57
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_NULLABLE, values);
58
+ }
59
+
60
+ @Override
61
+ public Collection<BackgroundLocation> getSessionLocations() {
62
+ Collection<BackgroundLocation> locations = new ArrayList<>();
63
+ String orderBy = SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME + " ASC";
64
+ Cursor cursor = null;
65
+ try {
66
+ cursor = db.query(
67
+ SQLiteSessionContract.SessionEntry.TABLE_NAME,
68
+ queryColumns(),
69
+ null, null, null, null, orderBy);
70
+ while (cursor.moveToNext()) {
71
+ locations.add(hydrate(cursor));
72
+ }
73
+ } finally {
74
+ if (cursor != null) cursor.close();
75
+ }
76
+ return locations;
77
+ }
78
+
79
+ @Override
80
+ public int getSessionLocationsCount() {
81
+ Cursor cursor = null;
82
+ try {
83
+ cursor = db.rawQuery("SELECT COUNT(*) FROM " + SQLiteSessionContract.SessionEntry.TABLE_NAME, null);
84
+ return cursor.moveToFirst() ? cursor.getInt(0) : 0;
85
+ } finally {
86
+ if (cursor != null) cursor.close();
87
+ }
88
+ }
89
+
90
+ private BackgroundLocation hydrate(Cursor c) {
91
+ BackgroundLocation l = new BackgroundLocation(c.getString(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_PROVIDER)));
92
+ l.setTime(c.getLong(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME)));
93
+ if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ACCURACY)) == 1) {
94
+ l.setAccuracy(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ACCURACY)));
95
+ }
96
+ if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY)) == 1) {
97
+ l.setVerticalAccuracy(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY)));
98
+ }
99
+ if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_SPEED)) == 1) {
100
+ l.setSpeed(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_SPEED)));
101
+ }
102
+ if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_BEARING)) == 1) {
103
+ l.setBearing(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_BEARING)));
104
+ }
105
+ if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ALTITUDE)) == 1) {
106
+ l.setAltitude(c.getDouble(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ALTITUDE)));
107
+ }
108
+ if (c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_RADIUS)) == 1) {
109
+ l.setRadius(c.getFloat(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_RADIUS)));
110
+ }
111
+ l.setLatitude(c.getDouble(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LATITUDE)));
112
+ l.setLongitude(c.getDouble(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LONGITUDE)));
113
+ l.setLocationProvider(c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LOCATION_PROVIDER)));
114
+ l.setLocationId(c.getLong(c.getColumnIndex(SQLiteSessionContract.SessionEntry._ID)));
115
+ l.setMockFlags(c.getInt(c.getColumnIndex(SQLiteSessionContract.SessionEntry.COLUMN_NAME_MOCK_FLAGS)));
116
+ return l;
117
+ }
118
+
119
+ private ContentValues getContentValues(BackgroundLocation l) {
120
+ ContentValues values = new ContentValues();
121
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_PROVIDER, l.getProvider());
122
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME, l.getTime());
123
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ACCURACY, l.getAccuracy());
124
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY, l.getVerticalAccuracy());
125
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_SPEED, l.getSpeed());
126
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_BEARING, l.getBearing());
127
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_ALTITUDE, l.getAltitude());
128
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_RADIUS, l.getRadius());
129
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LATITUDE, l.getLatitude());
130
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LONGITUDE, l.getLongitude());
131
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ACCURACY, l.hasAccuracy() ? 1 : 0);
132
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY, l.hasVerticalAccuracy() ? 1 : 0);
133
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_SPEED, l.hasSpeed() ? 1 : 0);
134
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_BEARING, l.hasBearing() ? 1 : 0);
135
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ALTITUDE, l.hasAltitude() ? 1 : 0);
136
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_RADIUS, l.hasRadius() ? 1 : 0);
137
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_LOCATION_PROVIDER, l.getLocationProvider());
138
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_STATUS, 0);
139
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_BATCH_START_MILLIS, 0L);
140
+ values.put(SQLiteSessionContract.SessionEntry.COLUMN_NAME_MOCK_FLAGS, l.getMockFlags());
141
+ return values;
142
+ }
143
+
144
+ private String[] queryColumns() {
145
+ return new String[]{
146
+ SQLiteSessionContract.SessionEntry._ID,
147
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_PROVIDER,
148
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_TIME,
149
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_ACCURACY,
150
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_VERTICAL_ACCURACY,
151
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_SPEED,
152
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_BEARING,
153
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_ALTITUDE,
154
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_RADIUS,
155
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_LATITUDE,
156
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_LONGITUDE,
157
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ACCURACY,
158
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_VERTICAL_ACCURACY,
159
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_SPEED,
160
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_BEARING,
161
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_ALTITUDE,
162
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_HAS_RADIUS,
163
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_LOCATION_PROVIDER,
164
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_STATUS,
165
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_BATCH_START_MILLIS,
166
+ SQLiteSessionContract.SessionEntry.COLUMN_NAME_MOCK_FLAGS
167
+ };
168
+ }
169
+ }
@@ -89,7 +89,7 @@ public abstract class AbstractLocationProvider implements LocationProvider {
89
89
  }
90
90
 
91
91
  /**
92
- * v4.5.2: drop fixes whose horizontal accuracy is worse than the configured
92
+ * v4.5.4: drop fixes whose horizontal accuracy is worse than the configured
93
93
  * maxAcceptedAccuracy threshold. Returns true when the location must be
94
94
  * discarded.
95
95
  */
@@ -169,7 +169,7 @@ public abstract class AbstractLocationProvider implements LocationProvider {
169
169
  }
170
170
 
171
171
  /**
172
- * v4.5.2: emit a permission-denied error to the delegate (used when a runtime
172
+ * v4.5.4: emit a permission-denied error to the delegate (used when a runtime
173
173
  * permission such as ACTIVITY_RECOGNITION is missing on Android 10+).
174
174
  */
175
175
  protected void handlePermissionDenied(String message) {
@@ -179,7 +179,7 @@ public abstract class AbstractLocationProvider implements LocationProvider {
179
179
  }
180
180
 
181
181
  /**
182
- * v4.5.2: emit a service-level error to the delegate (used when Google Play
182
+ * v4.5.4: emit a service-level error to the delegate (used when Google Play
183
183
  * Services is missing/outdated or the OS location service is disabled).
184
184
  */
185
185
  protected void handleServiceError(String message) {
@@ -195,7 +195,7 @@ public abstract class AbstractLocationProvider implements LocationProvider {
195
195
  }
196
196
 
197
197
  public Boolean hasMockLocationsEnabled() {
198
- // v4.5.2: Settings.Secure.getString may return null (key absent on the
198
+ // v4.5.4: Settings.Secure.getString may return null (key absent on the
199
199
  // device's settings provider). The previous code crashed with NPE because
200
200
  // it called .equals("1") on the returned value. Invert the comparison so
201
201
  // null safely yields false.
@@ -48,7 +48,7 @@ public class ActivityRecognitionLocationProvider extends AbstractLocationProvide
48
48
  private boolean stopOnStillWarningEmitted = false;
49
49
  private DetectedActivity lastActivity = new DetectedActivity(DetectedActivity.UNKNOWN, 100);
50
50
 
51
- // v4.5.2: snapshot of fields that require restarting tracking when they change.
51
+ // v4.5.4: snapshot of fields that require restarting tracking when they change.
52
52
  private Integer prevDesiredAccuracy;
53
53
  private Integer prevInterval;
54
54
  private Integer prevFastestInterval;
@@ -77,7 +77,7 @@ public class ActivityRecognitionLocationProvider extends AbstractLocationProvide
77
77
  public void onCreate() {
78
78
  super.onCreate();
79
79
 
80
- // v4.5.2: ACTIVITY_PROVIDER strictly depends on Google Play Services
80
+ // v4.5.4: ACTIVITY_PROVIDER strictly depends on Google Play Services
81
81
  // (FusedLocationProviderClient + ActivityRecognitionClient). If GPS is
82
82
  // missing/outdated we cannot operate — surface a clear error instead of
83
83
  // silently failing.
@@ -108,7 +108,7 @@ public class ActivityRecognitionLocationProvider extends AbstractLocationProvide
108
108
  logger.info("Start recording");
109
109
  this.isStarted = true;
110
110
 
111
- // v4.5.2: ACTIVITY_PROVIDER hinges on the STILL/ACTIVE state machine.
111
+ // v4.5.4: ACTIVITY_PROVIDER hinges on the STILL/ACTIVE state machine.
112
112
  // If the host turned that off, the provider degenerates into a tracker
113
113
  // that never pauses — warn so it shows up in logcat for the integrator.
114
114
  if (mConfig != null && Boolean.FALSE.equals(mConfig.getStopOnStillActivity()) && !stopOnStillWarningEmitted) {
@@ -129,7 +129,7 @@ public class ActivityRecognitionLocationProvider extends AbstractLocationProvide
129
129
 
130
130
  @Override
131
131
  public void onConfigure(Config config) {
132
- // v4.5.2: only restart tracking if a field that actually affects the
132
+ // v4.5.4: only restart tracking if a field that actually affects the
133
133
  // LocationRequest / activity-updates subscription has changed. A no-op
134
134
  // reconfigure used to drop+re-add the location callback and momentarily
135
135
  // leave the service without updates.
@@ -204,7 +204,7 @@ public class ActivityRecognitionLocationProvider extends AbstractLocationProvide
204
204
  int priority = translateDesiredAccuracy(mConfig.getDesiredAccuracy());
205
205
  // v3.4: LocationRequest.Builder (play-services-location 21.0.0+) replaces deprecated
206
206
  // LocationRequest.create() + setPriority/setInterval/setFastestInterval.
207
- // v4.5.2: also honor distanceFilter (was ignored on ACTIVITY_PROVIDER), so the
207
+ // v4.5.4: also honor distanceFilter (was ignored on ACTIVITY_PROVIDER), so the
208
208
  // FusedLocationProvider can throttle by distance and not just by interval.
209
209
  LocationRequest.Builder builder = new LocationRequest.Builder(priority, mConfig.getInterval())
210
210
  .setMinUpdateIntervalMillis(mConfig.getFastestInterval())
@@ -257,7 +257,7 @@ public class ActivityRecognitionLocationProvider extends AbstractLocationProvide
257
257
  startTracking();
258
258
 
259
259
  if (!isWatchingActivity && mConfig.getStopOnStillActivity()) {
260
- // v4.5.2: on Android 10+ ACTIVITY_RECOGNITION is a runtime permission.
260
+ // v4.5.4: on Android 10+ ACTIVITY_RECOGNITION is a runtime permission.
261
261
  // Without it, requestActivityUpdates() silently returns no broadcasts and
262
262
  // STILL/ACTIVE never flips — the provider then runs as a continuous tracker
263
263
  // by accident. Emit a one-shot error so the host app knows to request it.
@@ -341,7 +341,7 @@ public class ActivityRecognitionLocationProvider extends AbstractLocationProvide
341
341
 
342
342
  DetectedActivity candidate = getProbableActivity(detectedActivities);
343
343
 
344
- // v4.5.2: skip transitions whose confidence is below the configured
344
+ // v4.5.4: skip transitions whose confidence is below the configured
345
345
  // threshold (default 50). Prevents jittery STILL/ACTIVE flips when the
346
346
  // motion classifier is unsure — which translated into spurious GPS
347
347
  // start/stop bursts in earlier versions.
@@ -33,7 +33,7 @@ import static java.lang.Math.round;
33
33
 
34
34
 
35
35
  /**
36
- * v4.5.2 — Distance-filter provider with a runtime-chosen backend:
36
+ * v4.5.4 — Distance-filter provider with a runtime-chosen backend:
37
37
  * <ul>
38
38
  * <li><b>Fused path</b> (Play Services available): {@link FusedLocationProviderClient}
39
39
  * + {@link LocationCallback}. Better fused GPS+Network blending and battery.</li>
@@ -61,7 +61,7 @@ public class DistanceFilterLocationProvider extends AbstractLocationProvider imp
61
61
  private static final int MAX_STATIONARY_ACQUISITION_ATTEMPTS = 5;
62
62
  private static final int MAX_SPEED_ACQUISITION_ATTEMPTS = 3;
63
63
 
64
- // v4.5.2 — Aggressive interval used while acquiring stationary location or speed (FLP path).
64
+ // v4.5.4 — Aggressive interval used while acquiring stationary location or speed (FLP path).
65
65
  private static final long ACQUISITION_INTERVAL_MS = 1000L;
66
66
 
67
67
  private Boolean isMoving = false;
@@ -144,7 +144,7 @@ public class DistanceFilterLocationProvider extends AbstractLocationProvider imp
144
144
  locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
145
145
  alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
146
146
 
147
- // v4.5.2 — pick the location backend at runtime. Play Services missing
147
+ // v4.5.4 — pick the location backend at runtime. Play Services missing
148
148
  // (Huawei/HMS, AOSP, China ROMs) → use the OS LocationManager so the
149
149
  // provider still works.
150
150
  int gps = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext);
@@ -159,7 +159,7 @@ public class DistanceFilterLocationProvider extends AbstractLocationProvider imp
159
159
  int updateCurrentFlag = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
160
160
  ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE
161
161
  : PendingIntent.FLAG_UPDATE_CURRENT;
162
- // v4.5.2: singleUpdatePI must be MUTABLE on API 31+ because
162
+ // v4.5.4: singleUpdatePI must be MUTABLE on API 31+ because
163
163
  // LocationManager.requestSingleUpdate() fills the resulting Location
164
164
  // into the intent's extras at delivery time. FLAG_IMMUTABLE blocks that
165
165
  // population, so the receiver would never see the fix.
@@ -389,7 +389,7 @@ public class DistanceFilterLocationProvider extends AbstractLocationProvider imp
389
389
  }
390
390
  }
391
391
  } else {
392
- // v4.5.2 — subscribe to GPS AND Network simultaneously when both
392
+ // v4.5.4 — subscribe to GPS AND Network simultaneously when both
393
393
  // are available. The previous version only used GPS-or-Network
394
394
  // (excluyente), which on cheap/vehicular Androids could leave the
395
395
  // app waiting for a GPS fix while a quick Network fix was available.
@@ -438,7 +438,7 @@ public class DistanceFilterLocationProvider extends AbstractLocationProvider imp
438
438
  @Override
439
439
  public void onProviderDisabled(String provider) {
440
440
  logger.warn("Provider {} was disabled", provider);
441
- // v4.5.2: surface as an error so JS layer can prompt the user to enable
441
+ // v4.5.4: surface as an error so JS layer can prompt the user to enable
442
442
  // location services. Only when no fallback provider is left.
443
443
  if (locationManager != null && pickProvider() == null) {
444
444
  handleServiceError("Location provider '" + provider + "' disabled and no fallback available.");
@@ -523,7 +523,7 @@ public class DistanceFilterLocationProvider extends AbstractLocationProvider imp
523
523
  }
524
524
 
525
525
  /**
526
- * v4.5.2 — Stop active updates and start the polling-based stationary monitor.
526
+ * v4.5.4 — Stop active updates and start the polling-based stationary monitor.
527
527
  * The previous version also called {@code addProximityAlert} (geofence); that
528
528
  * path has been removed per product decision (no geofencing).
529
529
  */
@@ -14,7 +14,7 @@ import java.util.List;
14
14
  public class RawLocationProvider extends AbstractLocationProvider implements LocationListener {
15
15
  private LocationManager locationManager;
16
16
  private boolean isStarted = false;
17
- // v4.5.2: providers we actively subscribed to (so we can unsubscribe cleanly).
17
+ // v4.5.4: providers we actively subscribed to (so we can unsubscribe cleanly).
18
18
  private final List<String> activeProviders = new ArrayList<>(2);
19
19
 
20
20
  public RawLocationProvider(Context context) {
@@ -42,7 +42,7 @@ public class RawLocationProvider extends AbstractLocationProvider implements Loc
42
42
  logger.warn("RawLocationProvider started without config");
43
43
  return;
44
44
  }
45
- // v4.5.2: honor desiredAccuracy and subscribe to all suitable providers
45
+ // v4.5.4: honor desiredAccuracy and subscribe to all suitable providers
46
46
  // simultaneously (GPS + Network when available). Previously RAW only
47
47
  // used GPS-or-Network and ignored desiredAccuracy.
48
48
  List<String> providers = pickProviders();
@@ -67,7 +67,7 @@ public class RawLocationProvider extends AbstractLocationProvider implements Loc
67
67
  }
68
68
 
69
69
  /**
70
- * v4.5.2: choose providers based on desiredAccuracy.
70
+ * v4.5.4: choose providers based on desiredAccuracy.
71
71
  * <ul>
72
72
  * <li>&lt; 1000 m → include GPS when enabled (HIGH / BALANCED)</li>
73
73
  * <li>≥ 10 m → include Network when enabled (covers indoor and quick fixes)</li>
@@ -111,7 +111,7 @@ public class RawLocationProvider extends AbstractLocationProvider implements Loc
111
111
  return;
112
112
  }
113
113
  try {
114
- // v4.5.2: removeUpdates(this) detaches us from every provider we
114
+ // v4.5.4: removeUpdates(this) detaches us from every provider we
115
115
  // subscribed to via the same LocationListener.
116
116
  locationManager.removeUpdates(this);
117
117
  } catch (SecurityException e) {
@@ -158,7 +158,7 @@ public class RawLocationProvider extends AbstractLocationProvider implements Loc
158
158
  @Override
159
159
  public void onProviderDisabled(String provider) {
160
160
  logger.warn("Provider {} was disabled", provider);
161
- // v4.5.2: emit SERVICE error when no fallback provider is available so
161
+ // v4.5.4: emit SERVICE error when no fallback provider is available so
162
162
  // the JS layer can re-prompt the user. Matches DISTANCE_FILTER provider
163
163
  // behavior.
164
164
  if (locationManager != null && pickProvider() == null) {