@josuelmm/capacitor-background-geolocation 1.0.0
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.
- package/JosuelmmCapacitorBackgroundGeolocation.podspec +34 -0
- package/LICENSE +17 -0
- package/NOTICE.md +32 -0
- package/Package.swift +45 -0
- package/README.md +402 -0
- package/android/build.gradle +79 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/AndroidManifest.xml +83 -0
- package/android/src/main/java/com/evgenii/jsevaluator/HandlerWrapper.java +18 -0
- package/android/src/main/java/com/evgenii/jsevaluator/JavaScriptInterface.java +22 -0
- package/android/src/main/java/com/evgenii/jsevaluator/JsEvaluator.java +133 -0
- package/android/src/main/java/com/evgenii/jsevaluator/JsFunctionCallFormatter.java +37 -0
- package/android/src/main/java/com/evgenii/jsevaluator/WebViewWrapper.java +71 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/CallJavaResultInterface.java +8 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/HandlerWrapperInterface.java +5 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/JsCallback.java +10 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/JsEvaluatorInterface.java +18 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/WebViewWrapperInterface.java +14 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/BackgroundGeolocationPlugin.java +898 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/ConfigMapper.java +303 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/HeadlessTaskRegistry.java +34 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/JsEvaluatorTaskRunner.java +63 -0
- package/android/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java +699 -0
- package/android/src/main/java/com/marianhello/bgloc/BootCompletedReceiver.java +103 -0
- package/android/src/main/java/com/marianhello/bgloc/Config.java +1155 -0
- package/android/src/main/java/com/marianhello/bgloc/ConnectivityListener.java +5 -0
- package/android/src/main/java/com/marianhello/bgloc/HttpPostService.java +362 -0
- package/android/src/main/java/com/marianhello/bgloc/LocationManager.java +138 -0
- package/android/src/main/java/com/marianhello/bgloc/PluginDelegate.java +45 -0
- package/android/src/main/java/com/marianhello/bgloc/PluginException.java +38 -0
- package/android/src/main/java/com/marianhello/bgloc/PostLocationTask.java +238 -0
- package/android/src/main/java/com/marianhello/bgloc/ResourceResolver.java +55 -0
- package/android/src/main/java/com/marianhello/bgloc/data/AbstractLocationTemplate.java +69 -0
- package/android/src/main/java/com/marianhello/bgloc/data/ArrayListLocationTemplate.java +88 -0
- package/android/src/main/java/com/marianhello/bgloc/data/BackgroundActivity.java +108 -0
- package/android/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java +1088 -0
- package/android/src/main/java/com/marianhello/bgloc/data/ConfigJsonMapper.java +211 -0
- package/android/src/main/java/com/marianhello/bgloc/data/ConfigurationDAO.java +13 -0
- package/android/src/main/java/com/marianhello/bgloc/data/DAOFactory.java +17 -0
- package/android/src/main/java/com/marianhello/bgloc/data/HashMapLocationTemplate.java +82 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationDAO.java +27 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationTemplate.java +12 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationTemplateFactory.java +71 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationTransform.java +19 -0
- package/android/src/main/java/com/marianhello/bgloc/data/SessionLocationDAO.java +18 -0
- package/android/src/main/java/com/marianhello/bgloc/data/provider/ContentProviderLocationDAO.java +406 -0
- package/android/src/main/java/com/marianhello/bgloc/data/provider/LocationContentProvider.java +321 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationContract.java +94 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationDAO.java +227 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationContract.java +122 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationDAO.java +550 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteOpenHelper.java +189 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionContract.java +74 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionLocationDAO.java +169 -0
- package/android/src/main/java/com/marianhello/bgloc/driving/DrivingEventsDetector.java +265 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/AbstractTaskRunner.java +15 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/ActivityTask.java +48 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/JsCallback.java +10 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/LocationTask.java +60 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/StationaryTask.java +25 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/Task.java +8 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/TaskRunner.java +5 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/TaskRunnerFactory.java +8 -0
- package/android/src/main/java/com/marianhello/bgloc/http/UrlTemplateResolver.java +115 -0
- package/android/src/main/java/com/marianhello/bgloc/oem/BatteryOemHelper.java +214 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/AbstractLocationProvider.java +218 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/ActivityRecognitionLocationProvider.java +385 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/DistanceFilterLocationProvider.java +685 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/LocationProvider.java +32 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/LocationProviderFactory.java +47 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/ProviderDelegate.java +12 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/RawLocationProvider.java +175 -0
- package/android/src/main/java/com/marianhello/bgloc/sensor/SensorFusionDetector.java +199 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationService.java +16 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java +1531 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceInfo.java +6 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceInfoImpl.java +41 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java +203 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceProxy.java +156 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/AccountHelper.java +39 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/Authenticator.java +68 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/AuthenticatorService.java +28 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/BatchManager.java +311 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java +148 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java +301 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/SyncService.java +68 -0
- package/android/src/main/java/com/marianhello/logging/DBLogReader.java +208 -0
- package/android/src/main/java/com/marianhello/logging/LogEntry.java +99 -0
- package/android/src/main/java/com/marianhello/logging/LoggerManager.java +70 -0
- package/android/src/main/java/com/marianhello/logging/UncaughtExceptionLogger.java +36 -0
- package/android/src/main/java/com/marianhello/utils/CloneHelper.java +22 -0
- package/android/src/main/java/com/marianhello/utils/Convert.java +56 -0
- package/android/src/main/java/com/marianhello/utils/TextUtils.java +72 -0
- package/android/src/main/java/com/marianhello/utils/ToneGenerator.java +68 -0
- package/android/src/main/java/org/apache/commons/io/Charsets.java +153 -0
- package/android/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java +344 -0
- package/android/src/main/java/org/chromium/content/browser/ThreadUtils.java +134 -0
- package/android/src/main/java/ru/andremoniy/sqlbuilder/SqlExpression.java +398 -0
- package/android/src/main/java/ru/andremoniy/sqlbuilder/SqlSelectStatement.java +671 -0
- package/android/src/main/java/ru/andremoniy/sqlbuilder/SqlStatement.java +29 -0
- package/android/src/main/java/ru/andremoniy/utils/TextUtils.java +61 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/values/strings.xml +15 -0
- package/android/src/main/res/xml/authenticator.xml +7 -0
- package/android/src/main/res/xml/syncadapter.xml +9 -0
- package/dist/esm/definitions.d.ts +1052 -0
- package/dist/esm/definitions.js +142 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.js +23 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +92 -0
- package/dist/esm/web.js +242 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +415 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +418 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin-Bridging-Header.h +18 -0
- package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin.m +52 -0
- package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin.swift +750 -0
- package/ios/Tests/BackgroundGeolocationPluginTests/BackgroundGeolocationPluginTests.swift +12 -0
- package/ios/common/BackgroundGeolocation/CocoaLumberjack.h +1945 -0
- package/ios/common/BackgroundGeolocation/CocoaLumberjack.m +5255 -0
- package/ios/common/BackgroundGeolocation/FMDB.h +2357 -0
- package/ios/common/BackgroundGeolocation/FMDB.m +2672 -0
- package/ios/common/BackgroundGeolocation/FMDBLogger.h +42 -0
- package/ios/common/BackgroundGeolocation/FMDBLogger.m +264 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.h +41 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.m +68 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager+Internal.h +33 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.h +178 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.m +1025 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.h +103 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.m +238 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequestDefines.h +163 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.h +39 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.m +37 -0
- package/ios/common/BackgroundGeolocation/MAURAbstractLocationProvider.h +51 -0
- package/ios/common/BackgroundGeolocation/MAURAbstractLocationProvider.m +53 -0
- package/ios/common/BackgroundGeolocation/MAURActivity.h +23 -0
- package/ios/common/BackgroundGeolocation/MAURActivity.m +52 -0
- package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.h +18 -0
- package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.m +340 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.h +88 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.m +1193 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundSync.h +46 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundSync.m +283 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.h +25 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.m +105 -0
- package/ios/common/BackgroundGeolocation/MAURConfig.h +99 -0
- package/ios/common/BackgroundGeolocation/MAURConfig.m +636 -0
- package/ios/common/BackgroundGeolocation/MAURConfigurationContract.h +53 -0
- package/ios/common/BackgroundGeolocation/MAURConfigurationContract.m +54 -0
- package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.h +20 -0
- package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.m +550 -0
- package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.h +17 -0
- package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.m +124 -0
- package/ios/common/BackgroundGeolocation/MAURLocation.h +73 -0
- package/ios/common/BackgroundGeolocation/MAURLocation.m +392 -0
- package/ios/common/BackgroundGeolocation/MAURLocationContract.h +38 -0
- package/ios/common/BackgroundGeolocation/MAURLocationContract.m +39 -0
- package/ios/common/BackgroundGeolocation/MAURLocationManager.h +53 -0
- package/ios/common/BackgroundGeolocation/MAURLocationManager.m +305 -0
- package/ios/common/BackgroundGeolocation/MAURLogReader.h +26 -0
- package/ios/common/BackgroundGeolocation/MAURLogReader.m +122 -0
- package/ios/common/BackgroundGeolocation/MAURLogging.h +19 -0
- package/ios/common/BackgroundGeolocation/MAURPostLocationTask.h +53 -0
- package/ios/common/BackgroundGeolocation/MAURPostLocationTask.m +367 -0
- package/ios/common/BackgroundGeolocation/MAURProviderDelegate.h +52 -0
- package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.h +18 -0
- package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.m +138 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.h +26 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.m +335 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.h +57 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.m +93 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.h +52 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.m +520 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.h +32 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.m +276 -0
- package/ios/common/BackgroundGeolocation/MAURSensorFusionDetector.h +41 -0
- package/ios/common/BackgroundGeolocation/MAURSensorFusionDetector.m +137 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.h +29 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.m +31 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.h +25 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.m +153 -0
- package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.h +20 -0
- package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.m +62 -0
- package/ios/common/BackgroundGeolocation/MAURUrlTemplateResolver.h +31 -0
- package/ios/common/BackgroundGeolocation/MAURUrlTemplateResolver.m +107 -0
- package/ios/common/BackgroundGeolocation/Reachability.h +102 -0
- package/ios/common/BackgroundGeolocation/Reachability.m +475 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/README.md +170 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.h +55 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.m +47 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlDataManipulationCommand.h +27 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.h +250 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.m +259 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.h +360 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.m +427 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlStatement.h +37 -0
- package/ios/common/BackgroundGeolocation/module.modulemap +16 -0
- package/package.json +82 -0
|
@@ -0,0 +1,1155 @@
|
|
|
1
|
+
/*
|
|
2
|
+
According to apache license
|
|
3
|
+
|
|
4
|
+
This is fork of christocracy cordova-plugin-background-geolocation plugin
|
|
5
|
+
https://github.com/christocracy/cordova-plugin-background-geolocation
|
|
6
|
+
|
|
7
|
+
This is a new class
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.marianhello.bgloc;
|
|
11
|
+
|
|
12
|
+
import android.os.Bundle;
|
|
13
|
+
import android.os.Parcel;
|
|
14
|
+
import android.os.Parcelable;
|
|
15
|
+
import androidx.annotation.Nullable;
|
|
16
|
+
|
|
17
|
+
import com.marianhello.bgloc.data.AbstractLocationTemplate;
|
|
18
|
+
import com.marianhello.bgloc.data.LocationTemplate;
|
|
19
|
+
import com.marianhello.bgloc.data.LocationTemplateFactory;
|
|
20
|
+
import com.marianhello.utils.CloneHelper;
|
|
21
|
+
|
|
22
|
+
import org.json.JSONException;
|
|
23
|
+
import org.json.JSONObject;
|
|
24
|
+
|
|
25
|
+
import java.util.HashMap;
|
|
26
|
+
import java.util.Iterator;
|
|
27
|
+
import java.util.Locale;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Config class
|
|
31
|
+
*/
|
|
32
|
+
public class Config implements Parcelable
|
|
33
|
+
{
|
|
34
|
+
public static final String BUNDLE_KEY = "config";
|
|
35
|
+
|
|
36
|
+
public static final int DISTANCE_FILTER_PROVIDER = 0;
|
|
37
|
+
public static final int ACTIVITY_PROVIDER = 1;
|
|
38
|
+
public static final int RAW_PROVIDER = 2;
|
|
39
|
+
|
|
40
|
+
// NULL string config option to distinguish between java null
|
|
41
|
+
public static final String NullString = new String();
|
|
42
|
+
|
|
43
|
+
private Float stationaryRadius;
|
|
44
|
+
private Integer distanceFilter;
|
|
45
|
+
private Integer desiredAccuracy;
|
|
46
|
+
private Boolean debug;
|
|
47
|
+
private String notificationTitle;
|
|
48
|
+
private String notificationText;
|
|
49
|
+
private String notificationSyncTitle;
|
|
50
|
+
private String notificationSyncText;
|
|
51
|
+
private String notificationSyncCompletedText;
|
|
52
|
+
private String notificationSyncFailedText;
|
|
53
|
+
private String notificationIconLarge;
|
|
54
|
+
private String notificationIconSmall;
|
|
55
|
+
private String notificationIconColor;
|
|
56
|
+
private Integer locationProvider;
|
|
57
|
+
private Integer interval; //milliseconds
|
|
58
|
+
private Integer fastestInterval; //milliseconds
|
|
59
|
+
private Integer activitiesInterval; //milliseconds
|
|
60
|
+
private Boolean stopOnTerminate;
|
|
61
|
+
private Boolean startOnBoot;
|
|
62
|
+
private Boolean startForeground;
|
|
63
|
+
private Boolean notificationsEnabled;
|
|
64
|
+
private Boolean stopOnStillActivity;
|
|
65
|
+
private String url;
|
|
66
|
+
private String syncUrl;
|
|
67
|
+
private Integer syncThreshold;
|
|
68
|
+
private Boolean syncEnabled;
|
|
69
|
+
private HashMap httpHeaders;
|
|
70
|
+
private Integer maxLocations;
|
|
71
|
+
private LocationTemplate template;
|
|
72
|
+
private Boolean enableWatchdog;
|
|
73
|
+
private Boolean showTime;
|
|
74
|
+
private Boolean showDistance;
|
|
75
|
+
// v3.3 (Phase 2): backend-agnostic HTTP transport
|
|
76
|
+
private String httpMethod; // POST | GET | PUT | PATCH (default POST)
|
|
77
|
+
private String syncHttpMethod; // POST | GET | PUT | PATCH (default POST)
|
|
78
|
+
private String httpMode; // batch | single (default batch)
|
|
79
|
+
private String syncMode; // batch | single (default batch)
|
|
80
|
+
private HashMap queryParams; // static placeholder values for URL templating
|
|
81
|
+
// v3.5 (Phase 4): diagnostics
|
|
82
|
+
private Integer heartbeatInterval; // ms; 0 disables heartbeat events
|
|
83
|
+
private String mockLocationPolicy; // allow | flag | drop (default allow)
|
|
84
|
+
// v4.0 (Phase 6): driver insights
|
|
85
|
+
private DrivingEventsOptions drivingEvents;
|
|
86
|
+
// v4.4: include device battery in every location payload (default true).
|
|
87
|
+
private Boolean includeBattery;
|
|
88
|
+
// v4.5.1: battery-saving knobs.
|
|
89
|
+
/** WakeLock policy: 'none' | 'posting' | 'always'. Default 'posting'. */
|
|
90
|
+
private String wakeLockMode;
|
|
91
|
+
/** ms before declaring stationary. DistanceFilterLocationProvider default 5*60_000. */
|
|
92
|
+
private Integer stationaryTimeout;
|
|
93
|
+
/** Lazy poll interval while stationary (ms). Default 3*60_000. */
|
|
94
|
+
private Integer stationaryPollInterval;
|
|
95
|
+
/** Aggressive poll interval while stationary (ms). Default 60_000. */
|
|
96
|
+
private Integer stationaryPollFast;
|
|
97
|
+
// v4.5.2 — provider hardening
|
|
98
|
+
/** 0-100. Activity-recognition transitions below this confidence are ignored. Default 50. */
|
|
99
|
+
private Integer activityConfidenceThreshold;
|
|
100
|
+
/** Discard fixes whose `accuracy` (m) is worse than this. `null` (default) disables the filter. */
|
|
101
|
+
private Float maxAcceptedAccuracy;
|
|
102
|
+
|
|
103
|
+
/** v4.0 Phase 6 + v4.1: driver-insights configuration. Plain holder; no Parcelable to keep this class diff small. */
|
|
104
|
+
public static class DrivingEventsOptions {
|
|
105
|
+
public boolean enabled = false;
|
|
106
|
+
public double speedLimitKmh = 0;
|
|
107
|
+
public double minMovingSpeedMps = 1.0;
|
|
108
|
+
public long stoppedDurationMs = 60_000L;
|
|
109
|
+
public double minTripSpeedMps = 3.0;
|
|
110
|
+
public long minTripDurationMs = 30_000L;
|
|
111
|
+
// v4.1 GPS-derived sensor-like events. 0 disables each one.
|
|
112
|
+
public double hardBrakeMps2 = 3.5;
|
|
113
|
+
public double rapidAccelMps2 = 3.5;
|
|
114
|
+
public double sharpTurnDegPerSec = 30;
|
|
115
|
+
public double crashImpactKmh = 25;
|
|
116
|
+
public long crashWindowMs = 2_000L;
|
|
117
|
+
// v4.2 sensor fusion (real accelerometer + gyroscope).
|
|
118
|
+
public boolean sensorFusion = false;
|
|
119
|
+
public double crashImpactG = 3.0; // |a| threshold for sensor crash, in g
|
|
120
|
+
public long sensorCrashCooldownMs = 10_000L;
|
|
121
|
+
public long phoneUsageWindowMs = 4_000L;
|
|
122
|
+
public long phoneUsageCooldownMs = 60_000L;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public Config () {
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Copy constructor
|
|
129
|
+
public Config(Config config) {
|
|
130
|
+
this.stationaryRadius = config.stationaryRadius;
|
|
131
|
+
this.distanceFilter = config.distanceFilter;
|
|
132
|
+
this.desiredAccuracy = config.desiredAccuracy;
|
|
133
|
+
this.debug = config.debug;
|
|
134
|
+
this.notificationTitle = config.notificationTitle;
|
|
135
|
+
this.notificationText = config.notificationText;
|
|
136
|
+
this.notificationSyncTitle = config.notificationSyncTitle;
|
|
137
|
+
this.notificationSyncText = config.notificationSyncText;
|
|
138
|
+
this.notificationSyncCompletedText = config.notificationSyncCompletedText;
|
|
139
|
+
this.notificationSyncFailedText = config.notificationSyncFailedText;
|
|
140
|
+
this.notificationIconLarge = config.notificationIconLarge;
|
|
141
|
+
this.notificationIconSmall = config.notificationIconSmall;
|
|
142
|
+
this.notificationIconColor = config.notificationIconColor;
|
|
143
|
+
this.locationProvider = config.locationProvider;
|
|
144
|
+
this.interval = config.interval;
|
|
145
|
+
this.fastestInterval = config.fastestInterval;
|
|
146
|
+
this.activitiesInterval = config.activitiesInterval;
|
|
147
|
+
this.stopOnTerminate = config.stopOnTerminate;
|
|
148
|
+
this.startOnBoot = config.startOnBoot;
|
|
149
|
+
this.startForeground = config.startForeground;
|
|
150
|
+
this.notificationsEnabled = config.notificationsEnabled;
|
|
151
|
+
this.stopOnStillActivity = config.stopOnStillActivity;
|
|
152
|
+
this.url = config.url;
|
|
153
|
+
this.syncUrl = config.syncUrl;
|
|
154
|
+
this.syncThreshold = config.syncThreshold;
|
|
155
|
+
this.syncEnabled = config.syncEnabled;
|
|
156
|
+
this.httpHeaders = CloneHelper.deepCopy(config.httpHeaders);
|
|
157
|
+
this.maxLocations = config.maxLocations;
|
|
158
|
+
this.enableWatchdog = config.enableWatchdog;
|
|
159
|
+
this.showTime = config.showTime;
|
|
160
|
+
this.showDistance = config.showDistance;
|
|
161
|
+
this.httpMethod = config.httpMethod;
|
|
162
|
+
this.syncHttpMethod = config.syncHttpMethod;
|
|
163
|
+
this.httpMode = config.httpMode;
|
|
164
|
+
this.syncMode = config.syncMode;
|
|
165
|
+
this.queryParams = CloneHelper.deepCopy(config.queryParams);
|
|
166
|
+
this.heartbeatInterval = config.heartbeatInterval;
|
|
167
|
+
this.mockLocationPolicy = config.mockLocationPolicy;
|
|
168
|
+
this.includeBattery = config.includeBattery;
|
|
169
|
+
this.wakeLockMode = config.wakeLockMode;
|
|
170
|
+
this.stationaryTimeout = config.stationaryTimeout;
|
|
171
|
+
this.stationaryPollInterval = config.stationaryPollInterval;
|
|
172
|
+
this.stationaryPollFast = config.stationaryPollFast;
|
|
173
|
+
this.activityConfidenceThreshold = config.activityConfidenceThreshold;
|
|
174
|
+
this.maxAcceptedAccuracy = config.maxAcceptedAccuracy;
|
|
175
|
+
if (config.drivingEvents != null) {
|
|
176
|
+
DrivingEventsOptions de = new DrivingEventsOptions();
|
|
177
|
+
de.enabled = config.drivingEvents.enabled;
|
|
178
|
+
de.speedLimitKmh = config.drivingEvents.speedLimitKmh;
|
|
179
|
+
de.minMovingSpeedMps = config.drivingEvents.minMovingSpeedMps;
|
|
180
|
+
de.stoppedDurationMs = config.drivingEvents.stoppedDurationMs;
|
|
181
|
+
de.minTripSpeedMps = config.drivingEvents.minTripSpeedMps;
|
|
182
|
+
de.minTripDurationMs = config.drivingEvents.minTripDurationMs;
|
|
183
|
+
de.hardBrakeMps2 = config.drivingEvents.hardBrakeMps2;
|
|
184
|
+
de.rapidAccelMps2 = config.drivingEvents.rapidAccelMps2;
|
|
185
|
+
de.sharpTurnDegPerSec = config.drivingEvents.sharpTurnDegPerSec;
|
|
186
|
+
de.crashImpactKmh = config.drivingEvents.crashImpactKmh;
|
|
187
|
+
de.crashWindowMs = config.drivingEvents.crashWindowMs;
|
|
188
|
+
de.sensorFusion = config.drivingEvents.sensorFusion;
|
|
189
|
+
de.crashImpactG = config.drivingEvents.crashImpactG;
|
|
190
|
+
de.sensorCrashCooldownMs = config.drivingEvents.sensorCrashCooldownMs;
|
|
191
|
+
de.phoneUsageWindowMs = config.drivingEvents.phoneUsageWindowMs;
|
|
192
|
+
de.phoneUsageCooldownMs = config.drivingEvents.phoneUsageCooldownMs;
|
|
193
|
+
this.drivingEvents = de;
|
|
194
|
+
}
|
|
195
|
+
if (config.template instanceof AbstractLocationTemplate) {
|
|
196
|
+
this.template = ((AbstractLocationTemplate)config.template).clone();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private Config(Parcel in) {
|
|
201
|
+
setStationaryRadius(in.readFloat());
|
|
202
|
+
setDistanceFilter(in.readInt());
|
|
203
|
+
setDesiredAccuracy(in.readInt());
|
|
204
|
+
setDebugging((Boolean) in.readValue(null));
|
|
205
|
+
setNotificationTitle(in.readString());
|
|
206
|
+
setNotificationText(in.readString());
|
|
207
|
+
setNotificationSyncTitle(in.readString());
|
|
208
|
+
setNotificationSyncText(in.readString());
|
|
209
|
+
setNotificationSyncCompletedText(in.readString());
|
|
210
|
+
setNotificationSyncFailedText(in.readString());
|
|
211
|
+
setLargeNotificationIcon(in.readString());
|
|
212
|
+
setSmallNotificationIcon(in.readString());
|
|
213
|
+
setNotificationIconColor(in.readString());
|
|
214
|
+
setStopOnTerminate((Boolean) in.readValue(null));
|
|
215
|
+
setStartOnBoot((Boolean) in.readValue(null));
|
|
216
|
+
setStartForeground((Boolean) in.readValue(null));
|
|
217
|
+
setNotificationsEnabled((Boolean) in.readValue(null));
|
|
218
|
+
setLocationProvider(in.readInt());
|
|
219
|
+
setInterval(in.readInt());
|
|
220
|
+
setFastestInterval(in.readInt());
|
|
221
|
+
setActivitiesInterval(in.readInt());
|
|
222
|
+
setStopOnStillActivity((Boolean) in.readValue(null));
|
|
223
|
+
setUrl(in.readString());
|
|
224
|
+
setSyncUrl(in.readString());
|
|
225
|
+
setSyncThreshold(in.readInt());
|
|
226
|
+
setSyncEnabled((Boolean) in.readValue(null));
|
|
227
|
+
setMaxLocations(in.readInt());
|
|
228
|
+
setEnableWatchdog((Boolean) in.readValue(null));
|
|
229
|
+
setShowTime((Boolean) in.readValue(null));
|
|
230
|
+
setShowDistance((Boolean) in.readValue(null));
|
|
231
|
+
setHttpMethod(in.readString());
|
|
232
|
+
setSyncHttpMethod(in.readString());
|
|
233
|
+
setHttpMode(in.readString());
|
|
234
|
+
setSyncMode(in.readString());
|
|
235
|
+
setHeartbeatInterval((Integer) in.readValue(null));
|
|
236
|
+
setMockLocationPolicy(in.readString());
|
|
237
|
+
// v4.0 + v4.1: driver-insights options serialised as primitives.
|
|
238
|
+
boolean deEnabled = in.readInt() != 0;
|
|
239
|
+
double deSpeedLimit = in.readDouble();
|
|
240
|
+
double deMinMove = in.readDouble();
|
|
241
|
+
long deStoppedDur = in.readLong();
|
|
242
|
+
double deMinTrip = in.readDouble();
|
|
243
|
+
long deMinTripDur = in.readLong();
|
|
244
|
+
// v4.1
|
|
245
|
+
double deHardBrake = in.readDouble();
|
|
246
|
+
double deRapidAccel = in.readDouble();
|
|
247
|
+
double deSharpTurn = in.readDouble();
|
|
248
|
+
double deCrashKmh = in.readDouble();
|
|
249
|
+
long deCrashWin = in.readLong();
|
|
250
|
+
// v4.2 sensor fusion
|
|
251
|
+
boolean deSensorFusion = in.readInt() != 0;
|
|
252
|
+
double deCrashImpactG = in.readDouble();
|
|
253
|
+
long deSensorCrashCooldown = in.readLong();
|
|
254
|
+
long dePhoneUsageWindow = in.readLong();
|
|
255
|
+
long dePhoneUsageCooldown = in.readLong();
|
|
256
|
+
boolean deHasOptions = in.readInt() != 0;
|
|
257
|
+
if (deHasOptions) {
|
|
258
|
+
DrivingEventsOptions de = new DrivingEventsOptions();
|
|
259
|
+
de.enabled = deEnabled;
|
|
260
|
+
de.speedLimitKmh = deSpeedLimit;
|
|
261
|
+
de.minMovingSpeedMps = deMinMove;
|
|
262
|
+
de.stoppedDurationMs = deStoppedDur;
|
|
263
|
+
de.minTripSpeedMps = deMinTrip;
|
|
264
|
+
de.minTripDurationMs = deMinTripDur;
|
|
265
|
+
de.hardBrakeMps2 = deHardBrake;
|
|
266
|
+
de.rapidAccelMps2 = deRapidAccel;
|
|
267
|
+
de.sharpTurnDegPerSec = deSharpTurn;
|
|
268
|
+
de.crashImpactKmh = deCrashKmh;
|
|
269
|
+
de.crashWindowMs = deCrashWin;
|
|
270
|
+
de.sensorFusion = deSensorFusion;
|
|
271
|
+
de.crashImpactG = deCrashImpactG;
|
|
272
|
+
de.sensorCrashCooldownMs = deSensorCrashCooldown;
|
|
273
|
+
de.phoneUsageWindowMs = dePhoneUsageWindow;
|
|
274
|
+
de.phoneUsageCooldownMs = dePhoneUsageCooldown;
|
|
275
|
+
this.drivingEvents = de;
|
|
276
|
+
}
|
|
277
|
+
// v4.4: includeBattery
|
|
278
|
+
setIncludeBattery((Boolean) in.readValue(null));
|
|
279
|
+
// v4.5.1: battery-saving knobs
|
|
280
|
+
setWakeLockMode(in.readString());
|
|
281
|
+
setStationaryTimeout((Integer) in.readValue(null));
|
|
282
|
+
setStationaryPollInterval((Integer) in.readValue(null));
|
|
283
|
+
setStationaryPollFast((Integer) in.readValue(null));
|
|
284
|
+
// v4.5.2 provider hardening
|
|
285
|
+
setActivityConfidenceThreshold((Integer) in.readValue(null));
|
|
286
|
+
setMaxAcceptedAccuracy((Float) in.readValue(null));
|
|
287
|
+
// v4.5.1 — pass the plugin's classloader so getSerializable() can deserialize
|
|
288
|
+
// LocationTemplate / HashMap subclasses across IPC boundaries (e.g. SyncService :sync process).
|
|
289
|
+
Bundle bundle = in.readBundle(Config.class.getClassLoader());
|
|
290
|
+
setHttpHeaders((HashMap<String, String>) bundle.getSerializable("httpHeaders"));
|
|
291
|
+
setQueryParams((HashMap<String, String>) bundle.getSerializable("queryParams"));
|
|
292
|
+
setTemplate((LocationTemplate) bundle.getSerializable(AbstractLocationTemplate.BUNDLE_KEY));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public static Config getDefault() {
|
|
296
|
+
Config config = new Config();
|
|
297
|
+
config.stationaryRadius = 50f;
|
|
298
|
+
config.distanceFilter = 500;
|
|
299
|
+
config.desiredAccuracy = 100;
|
|
300
|
+
config.debug = false;
|
|
301
|
+
config.notificationTitle = "Background tracking";
|
|
302
|
+
config.notificationText = "ENABLED";
|
|
303
|
+
config.notificationSyncTitle = "Syncing locations";
|
|
304
|
+
config.notificationSyncText = "Sync in progress";
|
|
305
|
+
config.notificationSyncCompletedText = "Sync completed";
|
|
306
|
+
config.notificationSyncFailedText = "Sync failed";
|
|
307
|
+
config.notificationIconLarge = "";
|
|
308
|
+
config.notificationIconSmall = "";
|
|
309
|
+
config.notificationIconColor = "";
|
|
310
|
+
config.locationProvider = DISTANCE_FILTER_PROVIDER;
|
|
311
|
+
config.interval = 600000; //milliseconds
|
|
312
|
+
config.fastestInterval = 120000; //milliseconds
|
|
313
|
+
config.activitiesInterval = 10000; //milliseconds
|
|
314
|
+
config.stopOnTerminate = true;
|
|
315
|
+
config.startOnBoot = false;
|
|
316
|
+
config.startForeground = true;
|
|
317
|
+
config.notificationsEnabled = true;
|
|
318
|
+
config.stopOnStillActivity = true;
|
|
319
|
+
config.url = "";
|
|
320
|
+
config.syncUrl = "";
|
|
321
|
+
config.syncThreshold = 100;
|
|
322
|
+
config.syncEnabled = true;
|
|
323
|
+
config.httpHeaders = null;
|
|
324
|
+
config.maxLocations = 10000;
|
|
325
|
+
config.template = null;
|
|
326
|
+
config.enableWatchdog = false;
|
|
327
|
+
config.showTime = false;
|
|
328
|
+
config.showDistance = false;
|
|
329
|
+
config.httpMethod = "POST";
|
|
330
|
+
config.syncHttpMethod = "POST";
|
|
331
|
+
config.httpMode = "batch";
|
|
332
|
+
config.syncMode = "batch";
|
|
333
|
+
config.queryParams = null;
|
|
334
|
+
config.heartbeatInterval = 0;
|
|
335
|
+
config.mockLocationPolicy = "allow";
|
|
336
|
+
config.includeBattery = true; // v4.4: on by default
|
|
337
|
+
config.wakeLockMode = "posting"; // v4.5.1: hold wake lock only while posting/syncing
|
|
338
|
+
config.stationaryTimeout = 5 * 60 * 1000;
|
|
339
|
+
config.stationaryPollInterval = 3 * 60 * 1000;
|
|
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)
|
|
343
|
+
|
|
344
|
+
return config;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
public int describeContents() {
|
|
348
|
+
return 0;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// write your object's data to the passed-in Parcel
|
|
352
|
+
public void writeToParcel(Parcel out, int flags) {
|
|
353
|
+
out.writeFloat(getStationaryRadius());
|
|
354
|
+
out.writeInt(getDistanceFilter());
|
|
355
|
+
out.writeInt(getDesiredAccuracy());
|
|
356
|
+
out.writeValue(isDebugging());
|
|
357
|
+
out.writeString(getNotificationTitle());
|
|
358
|
+
out.writeString(getNotificationText());
|
|
359
|
+
out.writeString(getNotificationSyncTitle());
|
|
360
|
+
out.writeString(getNotificationSyncText());
|
|
361
|
+
out.writeString(getNotificationSyncCompletedText());
|
|
362
|
+
out.writeString(getNotificationSyncFailedText());
|
|
363
|
+
out.writeString(getLargeNotificationIcon());
|
|
364
|
+
out.writeString(getSmallNotificationIcon());
|
|
365
|
+
out.writeString(getNotificationIconColor());
|
|
366
|
+
out.writeValue(getStopOnTerminate());
|
|
367
|
+
out.writeValue(getStartOnBoot());
|
|
368
|
+
out.writeValue(getStartForeground());
|
|
369
|
+
out.writeValue(getNotificationsEnabled());
|
|
370
|
+
out.writeInt(getLocationProvider());
|
|
371
|
+
out.writeInt(getInterval());
|
|
372
|
+
out.writeInt(getFastestInterval());
|
|
373
|
+
out.writeInt(getActivitiesInterval());
|
|
374
|
+
out.writeValue(getStopOnStillActivity());
|
|
375
|
+
out.writeString(getUrl());
|
|
376
|
+
out.writeString(getSyncUrl());
|
|
377
|
+
out.writeInt(getSyncThreshold());
|
|
378
|
+
out.writeValue(getSyncEnabled());
|
|
379
|
+
out.writeInt(getMaxLocations());
|
|
380
|
+
out.writeValue(getEnableWatchdog());
|
|
381
|
+
out.writeValue(getShowTime());
|
|
382
|
+
out.writeValue(getShowDistance());
|
|
383
|
+
out.writeString(getHttpMethod());
|
|
384
|
+
out.writeString(getSyncHttpMethod());
|
|
385
|
+
out.writeString(getHttpMode());
|
|
386
|
+
out.writeString(getSyncMode());
|
|
387
|
+
out.writeValue(getHeartbeatInterval());
|
|
388
|
+
out.writeString(getMockLocationPolicy());
|
|
389
|
+
// v4.0 + v4.1: drivingEvents primitives (always written; "hasOptions" flag at end).
|
|
390
|
+
DrivingEventsOptions de = drivingEvents;
|
|
391
|
+
out.writeInt(de != null && de.enabled ? 1 : 0);
|
|
392
|
+
out.writeDouble(de != null ? de.speedLimitKmh : 0.0);
|
|
393
|
+
out.writeDouble(de != null ? de.minMovingSpeedMps : 1.0);
|
|
394
|
+
out.writeLong (de != null ? de.stoppedDurationMs : 60_000L);
|
|
395
|
+
out.writeDouble(de != null ? de.minTripSpeedMps : 3.0);
|
|
396
|
+
out.writeLong (de != null ? de.minTripDurationMs : 30_000L);
|
|
397
|
+
// v4.1
|
|
398
|
+
out.writeDouble(de != null ? de.hardBrakeMps2 : 3.5);
|
|
399
|
+
out.writeDouble(de != null ? de.rapidAccelMps2 : 3.5);
|
|
400
|
+
out.writeDouble(de != null ? de.sharpTurnDegPerSec: 30.0);
|
|
401
|
+
out.writeDouble(de != null ? de.crashImpactKmh : 25.0);
|
|
402
|
+
out.writeLong (de != null ? de.crashWindowMs : 2_000L);
|
|
403
|
+
// v4.2 sensor fusion
|
|
404
|
+
out.writeInt (de != null && de.sensorFusion ? 1 : 0);
|
|
405
|
+
out.writeDouble(de != null ? de.crashImpactG : 3.0);
|
|
406
|
+
out.writeLong (de != null ? de.sensorCrashCooldownMs : 10_000L);
|
|
407
|
+
out.writeLong (de != null ? de.phoneUsageWindowMs : 4_000L);
|
|
408
|
+
out.writeLong (de != null ? de.phoneUsageCooldownMs : 60_000L);
|
|
409
|
+
out.writeInt (de != null ? 1 : 0);
|
|
410
|
+
// v4.4: includeBattery
|
|
411
|
+
out.writeValue(getIncludeBattery());
|
|
412
|
+
// v4.5.1
|
|
413
|
+
out.writeString(getWakeLockMode());
|
|
414
|
+
out.writeValue(getStationaryTimeout());
|
|
415
|
+
out.writeValue(getStationaryPollInterval());
|
|
416
|
+
out.writeValue(getStationaryPollFast());
|
|
417
|
+
// v4.5.2
|
|
418
|
+
out.writeValue(getActivityConfidenceThreshold());
|
|
419
|
+
out.writeValue(getMaxAcceptedAccuracy());
|
|
420
|
+
Bundle bundle = new Bundle();
|
|
421
|
+
bundle.putSerializable("httpHeaders", getHttpHeaders());
|
|
422
|
+
bundle.putSerializable("queryParams", getQueryParams());
|
|
423
|
+
bundle.putSerializable(AbstractLocationTemplate.BUNDLE_KEY, (AbstractLocationTemplate) getTemplate());
|
|
424
|
+
out.writeBundle(bundle);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
public static final Parcelable.Creator<Config> CREATOR
|
|
428
|
+
= new Parcelable.Creator<Config>() {
|
|
429
|
+
public Config createFromParcel(Parcel in) {
|
|
430
|
+
return new Config(in);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
public Config[] newArray(int size) {
|
|
434
|
+
return new Config[size];
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
public boolean hasStationaryRadius() {
|
|
439
|
+
return stationaryRadius != null;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
public Float getStationaryRadius() {
|
|
443
|
+
return stationaryRadius;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
public void setStationaryRadius(float stationaryRadius) {
|
|
447
|
+
this.stationaryRadius = stationaryRadius;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
public void setStationaryRadius(double stationaryRadius) {
|
|
451
|
+
this.stationaryRadius = (float) stationaryRadius;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
public boolean hasDesiredAccuracy() {
|
|
455
|
+
return desiredAccuracy != null;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
public Integer getDesiredAccuracy() {
|
|
459
|
+
return desiredAccuracy;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
public void setDesiredAccuracy(Integer desiredAccuracy) {
|
|
463
|
+
this.desiredAccuracy = desiredAccuracy;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
public boolean hasDistanceFilter() {
|
|
467
|
+
return distanceFilter != null;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
public Integer getDistanceFilter() {
|
|
471
|
+
return distanceFilter;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
public void setDistanceFilter(Integer distanceFilter) {
|
|
475
|
+
this.distanceFilter = distanceFilter;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
public boolean hasDebug() {
|
|
479
|
+
return debug != null;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
public Boolean isDebugging() {
|
|
483
|
+
return debug != null && debug;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
public void setDebugging(Boolean debug) {
|
|
487
|
+
this.debug = debug;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
public boolean hasNotificationIconColor() {
|
|
491
|
+
return notificationIconColor != null && !notificationIconColor.isEmpty();
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
public String getNotificationIconColor() {
|
|
495
|
+
return notificationIconColor;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
public void setNotificationIconColor(String notificationIconColor) {
|
|
499
|
+
this.notificationIconColor = notificationIconColor;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
public boolean hasNotificationTitle() {
|
|
503
|
+
return notificationTitle != null;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
public String getNotificationTitle() {
|
|
507
|
+
return notificationTitle;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
public void setNotificationTitle(String notificationTitle) {
|
|
511
|
+
this.notificationTitle = notificationTitle;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
public boolean hasNotificationText() {
|
|
515
|
+
return notificationText != null;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
public String getNotificationText() {
|
|
519
|
+
return notificationText;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
public void setNotificationText(String notificationText) {
|
|
523
|
+
this.notificationText = notificationText;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
public String getNotificationSyncTitle() {
|
|
527
|
+
return notificationSyncTitle != null ? notificationSyncTitle : "Syncing locations";
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
public void setNotificationSyncTitle(String notificationSyncTitle) {
|
|
531
|
+
this.notificationSyncTitle = notificationSyncTitle;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
public String getNotificationSyncText() {
|
|
535
|
+
return notificationSyncText != null ? notificationSyncText : "Sync in progress";
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
public void setNotificationSyncText(String notificationSyncText) {
|
|
539
|
+
this.notificationSyncText = notificationSyncText;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
public String getNotificationSyncCompletedText() {
|
|
543
|
+
return notificationSyncCompletedText != null ? notificationSyncCompletedText : "Sync completed";
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
public void setNotificationSyncCompletedText(String notificationSyncCompletedText) {
|
|
547
|
+
this.notificationSyncCompletedText = notificationSyncCompletedText;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
public String getNotificationSyncFailedText() {
|
|
551
|
+
return notificationSyncFailedText != null ? notificationSyncFailedText : "Sync failed";
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
public void setNotificationSyncFailedText(String notificationSyncFailedText) {
|
|
555
|
+
this.notificationSyncFailedText = notificationSyncFailedText;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
public boolean hasLargeNotificationIcon() {
|
|
559
|
+
return notificationIconLarge != null && !notificationIconLarge.isEmpty();
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
public String getLargeNotificationIcon () {
|
|
563
|
+
return notificationIconLarge;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
public void setLargeNotificationIcon (String icon) {
|
|
567
|
+
this.notificationIconLarge = icon;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
public boolean hasSmallNotificationIcon() {
|
|
571
|
+
return notificationIconSmall != null && !notificationIconSmall.isEmpty();
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
public String getSmallNotificationIcon () {
|
|
575
|
+
return notificationIconSmall;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
public void setSmallNotificationIcon (String icon) {
|
|
579
|
+
this.notificationIconSmall = icon;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
public boolean hasStopOnTerminate() {
|
|
583
|
+
return stopOnTerminate != null;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
public Boolean getStopOnTerminate() {
|
|
587
|
+
return stopOnTerminate;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
public void setStopOnTerminate(Boolean stopOnTerminate) {
|
|
591
|
+
this.stopOnTerminate = stopOnTerminate;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
public boolean hasStartOnBoot() {
|
|
595
|
+
return startOnBoot != null;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
public Boolean getStartOnBoot() {
|
|
599
|
+
return startOnBoot;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
public void setStartOnBoot(Boolean startOnBoot) {
|
|
603
|
+
this.startOnBoot = startOnBoot;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
public boolean hasStartForeground() {
|
|
607
|
+
return startForeground != null;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
public Boolean getStartForeground() {
|
|
611
|
+
return startForeground;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
public void setStartForeground(Boolean startForeground) {
|
|
615
|
+
this.startForeground = startForeground;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
public boolean hasNotificationsEnabled() {
|
|
619
|
+
return notificationsEnabled != null;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
@Nullable
|
|
623
|
+
public Boolean getNotificationsEnabled() {
|
|
624
|
+
return notificationsEnabled;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
public void setNotificationsEnabled(@Nullable Boolean notificationsEnabled) {
|
|
628
|
+
this.notificationsEnabled = notificationsEnabled;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
public boolean hasLocationProvider() {
|
|
632
|
+
return locationProvider != null;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
public Integer getLocationProvider() {
|
|
636
|
+
return locationProvider;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
public void setLocationProvider(Integer locationProvider) {
|
|
640
|
+
this.locationProvider = locationProvider;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
public boolean hasInterval() {
|
|
644
|
+
return interval != null;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
public Integer getInterval() {
|
|
648
|
+
return interval;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
public void setInterval(Integer interval) {
|
|
652
|
+
this.interval = interval;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
public boolean hasFastestInterval() {
|
|
656
|
+
return fastestInterval != null;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
public Integer getFastestInterval() {
|
|
660
|
+
return fastestInterval;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
public void setFastestInterval(Integer fastestInterval) {
|
|
664
|
+
this.fastestInterval = fastestInterval;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
public boolean hasActivitiesInterval() {
|
|
668
|
+
return activitiesInterval != null;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
public Integer getActivitiesInterval() {
|
|
672
|
+
return activitiesInterval;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
public void setActivitiesInterval(Integer activitiesInterval) {
|
|
676
|
+
this.activitiesInterval = activitiesInterval;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
public boolean hasStopOnStillActivity() {
|
|
680
|
+
return stopOnStillActivity != null;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
public Boolean getStopOnStillActivity() {
|
|
684
|
+
return stopOnStillActivity;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
public void setStopOnStillActivity(Boolean stopOnStillActivity) {
|
|
688
|
+
this.stopOnStillActivity = stopOnStillActivity;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
public boolean hasUrl() {
|
|
692
|
+
return url != null;
|
|
693
|
+
}
|
|
694
|
+
public boolean hasValidUrl() {
|
|
695
|
+
return url != null && !url.isEmpty();
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
public String getUrl() {
|
|
699
|
+
return url;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
public void setUrl(String url) {
|
|
703
|
+
this.url = url;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
public boolean hasSyncUrl() {
|
|
707
|
+
return syncUrl != null;
|
|
708
|
+
}
|
|
709
|
+
public boolean hasValidSyncUrl() {
|
|
710
|
+
return syncUrl != null && !syncUrl.isEmpty();
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
public String getSyncUrl() {
|
|
714
|
+
return syncUrl;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
public void setSyncUrl(String syncUrl) {
|
|
718
|
+
this.syncUrl = syncUrl;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
public boolean hasSyncThreshold() {
|
|
722
|
+
return syncThreshold != null;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
public Integer getSyncThreshold() {
|
|
726
|
+
return syncThreshold;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
public void setSyncThreshold(Integer syncThreshold) {
|
|
730
|
+
this.syncThreshold = syncThreshold;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
public boolean hasSyncEnabled() {
|
|
734
|
+
return syncEnabled != null;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/** Whether synchronization to syncUrl is enabled. Default true. */
|
|
738
|
+
@Nullable
|
|
739
|
+
public Boolean getSyncEnabled() {
|
|
740
|
+
return syncEnabled != null ? syncEnabled : true;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
public void setSyncEnabled(@Nullable Boolean syncEnabled) {
|
|
744
|
+
this.syncEnabled = syncEnabled;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
public boolean hasHttpHeaders() {
|
|
748
|
+
return httpHeaders != null;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
public HashMap<String, String> getHttpHeaders() {
|
|
752
|
+
if (!hasHttpHeaders()) {
|
|
753
|
+
httpHeaders = new HashMap<String, String>();
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return httpHeaders;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
public void setHttpHeaders(HashMap httpHeaders) {
|
|
760
|
+
this.httpHeaders = httpHeaders;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
public void setHttpHeaders(JSONObject httpHeaders) throws JSONException {
|
|
764
|
+
// intentionally set httpHeaders to empty hash map
|
|
765
|
+
// this allows to reset headers in .fromJSONArray providing empty httpHeaders JSONObject
|
|
766
|
+
this.httpHeaders = new HashMap<String, String>();
|
|
767
|
+
if (httpHeaders == null) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
Iterator<?> it = httpHeaders.keys();
|
|
771
|
+
while (it.hasNext()) {
|
|
772
|
+
String key = (String) it.next();
|
|
773
|
+
this.httpHeaders.put(key, httpHeaders.getString(key));
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
public boolean hasMaxLocations() {
|
|
778
|
+
return maxLocations != null;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
public Integer getMaxLocations() {
|
|
782
|
+
return maxLocations;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
public void setMaxLocations(Integer maxLocations) {
|
|
786
|
+
this.maxLocations = maxLocations;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
public boolean hasTemplate() {
|
|
790
|
+
return template != null;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
public LocationTemplate getTemplate() {
|
|
794
|
+
if (!hasTemplate()) {
|
|
795
|
+
template = LocationTemplateFactory.getDefault();
|
|
796
|
+
}
|
|
797
|
+
return template;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
public void setTemplate(LocationTemplate template) {
|
|
801
|
+
this.template = template;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
public boolean hasEnableWatchdog() {
|
|
805
|
+
return enableWatchdog != null;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
@Nullable
|
|
809
|
+
public Boolean getEnableWatchdog() {
|
|
810
|
+
return enableWatchdog;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
public void setEnableWatchdog(Boolean enableWatchdog) {
|
|
814
|
+
this.enableWatchdog = enableWatchdog;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
@Nullable
|
|
818
|
+
public Boolean getIncludeBattery() {
|
|
819
|
+
return includeBattery;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
public void setIncludeBattery(Boolean includeBattery) {
|
|
823
|
+
this.includeBattery = includeBattery;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
@Nullable public String getWakeLockMode() { return wakeLockMode; }
|
|
827
|
+
public void setWakeLockMode(String mode) { this.wakeLockMode = mode; }
|
|
828
|
+
@Nullable public Integer getStationaryTimeout() { return stationaryTimeout; }
|
|
829
|
+
public void setStationaryTimeout(Integer ms) { this.stationaryTimeout = ms; }
|
|
830
|
+
@Nullable public Integer getStationaryPollInterval() { return stationaryPollInterval; }
|
|
831
|
+
public void setStationaryPollInterval(Integer ms) { this.stationaryPollInterval = ms; }
|
|
832
|
+
@Nullable public Integer getStationaryPollFast() { return stationaryPollFast; }
|
|
833
|
+
public void setStationaryPollFast(Integer ms) { this.stationaryPollFast = ms; }
|
|
834
|
+
@Nullable public Integer getActivityConfidenceThreshold() { return activityConfidenceThreshold; }
|
|
835
|
+
public void setActivityConfidenceThreshold(Integer v) { this.activityConfidenceThreshold = v; }
|
|
836
|
+
@Nullable public Float getMaxAcceptedAccuracy() { return maxAcceptedAccuracy; }
|
|
837
|
+
public void setMaxAcceptedAccuracy(Float v) { this.maxAcceptedAccuracy = v; }
|
|
838
|
+
|
|
839
|
+
public boolean hasShowTime() {
|
|
840
|
+
return showTime != null;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
@Nullable
|
|
844
|
+
public Boolean getShowTime() {
|
|
845
|
+
return showTime;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
public void setShowTime(Boolean showTime) {
|
|
849
|
+
this.showTime = showTime;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
public boolean hasShowDistance() {
|
|
853
|
+
return showDistance != null;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
@Nullable
|
|
857
|
+
public Boolean getShowDistance() {
|
|
858
|
+
return showDistance;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
public void setShowDistance(Boolean showDistance) {
|
|
862
|
+
this.showDistance = showDistance;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/** HTTP method for the main `url`. Default POST. */
|
|
866
|
+
@Nullable
|
|
867
|
+
public String getHttpMethod() {
|
|
868
|
+
return httpMethod != null ? httpMethod : "POST";
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
public void setHttpMethod(@Nullable String httpMethod) {
|
|
872
|
+
this.httpMethod = (httpMethod == null || httpMethod.isEmpty()) ? null : httpMethod.toUpperCase(Locale.US);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/** HTTP method for the `syncUrl`. Default POST. */
|
|
876
|
+
@Nullable
|
|
877
|
+
public String getSyncHttpMethod() {
|
|
878
|
+
return syncHttpMethod != null ? syncHttpMethod : "POST";
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
public void setSyncHttpMethod(@Nullable String syncHttpMethod) {
|
|
882
|
+
this.syncHttpMethod = (syncHttpMethod == null || syncHttpMethod.isEmpty()) ? null : syncHttpMethod.toUpperCase(Locale.US);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/** Real-time post mode. "batch" (default) or "single". */
|
|
886
|
+
@Nullable
|
|
887
|
+
public String getHttpMode() {
|
|
888
|
+
return httpMode != null ? httpMode : "batch";
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
public void setHttpMode(@Nullable String httpMode) {
|
|
892
|
+
this.httpMode = (httpMode == null || httpMode.isEmpty()) ? null : httpMode.toLowerCase(Locale.US);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/** Sync queue mode. "batch" (default) or "single". */
|
|
896
|
+
@Nullable
|
|
897
|
+
public String getSyncMode() {
|
|
898
|
+
return syncMode != null ? syncMode : "batch";
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
public void setSyncMode(@Nullable String syncMode) {
|
|
902
|
+
this.syncMode = (syncMode == null || syncMode.isEmpty()) ? null : syncMode.toLowerCase(Locale.US);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
public boolean hasQueryParams() {
|
|
906
|
+
return queryParams != null && !queryParams.isEmpty();
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
public HashMap<String, String> getQueryParams() {
|
|
910
|
+
return queryParams;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
public void setQueryParams(HashMap queryParams) {
|
|
914
|
+
this.queryParams = queryParams;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
public void setQueryParams(JSONObject queryParams) throws JSONException {
|
|
918
|
+
this.queryParams = new HashMap<String, String>();
|
|
919
|
+
if (queryParams == null) return;
|
|
920
|
+
Iterator<?> it = queryParams.keys();
|
|
921
|
+
while (it.hasNext()) {
|
|
922
|
+
String key = (String) it.next();
|
|
923
|
+
// queryParams accepts string | number (per d.ts). Convert numbers to string.
|
|
924
|
+
Object value = queryParams.get(key);
|
|
925
|
+
this.queryParams.put(key, value == null || value == JSONObject.NULL ? "" : String.valueOf(value));
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/** Heartbeat emit interval in ms. 0 disables. */
|
|
930
|
+
@Nullable
|
|
931
|
+
public Integer getHeartbeatInterval() {
|
|
932
|
+
return heartbeatInterval != null ? heartbeatInterval : 0;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
public void setHeartbeatInterval(Integer heartbeatInterval) {
|
|
936
|
+
this.heartbeatInterval = heartbeatInterval;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
/** Mock location policy: "allow" | "flag" | "drop". Default "allow". */
|
|
940
|
+
@Nullable
|
|
941
|
+
public String getMockLocationPolicy() {
|
|
942
|
+
return mockLocationPolicy != null ? mockLocationPolicy : "allow";
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
public void setMockLocationPolicy(@Nullable String mockLocationPolicy) {
|
|
946
|
+
this.mockLocationPolicy = (mockLocationPolicy == null || mockLocationPolicy.isEmpty())
|
|
947
|
+
? null
|
|
948
|
+
: mockLocationPolicy.toLowerCase(Locale.US);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/** v4.0 Phase 6: driver-insights options. */
|
|
952
|
+
@Nullable
|
|
953
|
+
public DrivingEventsOptions getDrivingEvents() {
|
|
954
|
+
return drivingEvents;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
public void setDrivingEvents(@Nullable DrivingEventsOptions drivingEvents) {
|
|
958
|
+
this.drivingEvents = drivingEvents;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
@Override
|
|
962
|
+
public String toString () {
|
|
963
|
+
return new StringBuffer()
|
|
964
|
+
.append("Config[distanceFilter=").append(getDistanceFilter())
|
|
965
|
+
.append(" stationaryRadius=").append(getStationaryRadius())
|
|
966
|
+
.append(" desiredAccuracy=").append(getDesiredAccuracy())
|
|
967
|
+
.append(" interval=").append(getInterval())
|
|
968
|
+
.append(" fastestInterval=").append(getFastestInterval())
|
|
969
|
+
.append(" activitiesInterval=").append(getActivitiesInterval())
|
|
970
|
+
.append(" isDebugging=").append(isDebugging())
|
|
971
|
+
.append(" stopOnTerminate=" ).append(getStopOnTerminate())
|
|
972
|
+
.append(" stopOnStillActivity=").append(getStopOnStillActivity())
|
|
973
|
+
.append(" startOnBoot=").append(getStartOnBoot())
|
|
974
|
+
.append(" startForeground=").append(getStartForeground())
|
|
975
|
+
.append(" notificationsEnabled=").append(getNotificationsEnabled())
|
|
976
|
+
.append(" locationProvider=").append(getLocationProvider())
|
|
977
|
+
.append(" nTitle=").append(getNotificationTitle())
|
|
978
|
+
.append(" nText=").append(getNotificationText())
|
|
979
|
+
.append(" nIconLarge=").append(getLargeNotificationIcon())
|
|
980
|
+
.append(" nIconSmall=").append(getSmallNotificationIcon())
|
|
981
|
+
.append(" nIconColor=").append(getNotificationIconColor())
|
|
982
|
+
.append(" url=").append(getUrl())
|
|
983
|
+
.append(" syncUrl=").append(getSyncUrl())
|
|
984
|
+
.append(" syncThreshold=").append(getSyncThreshold())
|
|
985
|
+
.append(" syncEnabled=").append(getSyncEnabled())
|
|
986
|
+
.append(" httpHeaders=").append(getHttpHeaders().toString())
|
|
987
|
+
.append(" maxLocations=").append(getMaxLocations())
|
|
988
|
+
.append(" postTemplate=").append(hasTemplate() ? getTemplate().toString() : null)
|
|
989
|
+
.append(" showTime=").append(getShowTime())
|
|
990
|
+
.append(" showDistance=").append(getShowDistance())
|
|
991
|
+
.append(" httpMethod=").append(getHttpMethod())
|
|
992
|
+
.append(" syncHttpMethod=").append(getSyncHttpMethod())
|
|
993
|
+
.append(" httpMode=").append(getHttpMode())
|
|
994
|
+
.append(" syncMode=").append(getSyncMode())
|
|
995
|
+
.append(" queryParams=").append(hasQueryParams() ? getQueryParams().toString() : null)
|
|
996
|
+
.append("]")
|
|
997
|
+
.toString();
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
public Parcel toParcel () {
|
|
1001
|
+
Parcel parcel = Parcel.obtain();
|
|
1002
|
+
this.writeToParcel(parcel, 0);
|
|
1003
|
+
parcel.setDataPosition(0);
|
|
1004
|
+
return parcel;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
public Bundle toBundle () {
|
|
1008
|
+
Bundle bundle = new Bundle();
|
|
1009
|
+
bundle.putParcelable(BUNDLE_KEY, this);
|
|
1010
|
+
return bundle;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
public static Config merge(Config config1, Config config2) {
|
|
1014
|
+
Config merger = new Config(config1);
|
|
1015
|
+
|
|
1016
|
+
if (config2.hasStationaryRadius()) {
|
|
1017
|
+
merger.setStationaryRadius(config2.getStationaryRadius());
|
|
1018
|
+
}
|
|
1019
|
+
if (config2.hasDistanceFilter()) {
|
|
1020
|
+
merger.setDistanceFilter(config2.getDistanceFilter());
|
|
1021
|
+
}
|
|
1022
|
+
if (config2.hasDesiredAccuracy()) {
|
|
1023
|
+
merger.setDesiredAccuracy(config2.getDesiredAccuracy());
|
|
1024
|
+
}
|
|
1025
|
+
if (config2.hasDebug()) {
|
|
1026
|
+
merger.setDebugging(config2.isDebugging());
|
|
1027
|
+
}
|
|
1028
|
+
if (config2.hasNotificationTitle()) {
|
|
1029
|
+
merger.setNotificationTitle(config2.getNotificationTitle());
|
|
1030
|
+
}
|
|
1031
|
+
if (config2.hasNotificationText()) {
|
|
1032
|
+
merger.setNotificationText(config2.getNotificationText());
|
|
1033
|
+
}
|
|
1034
|
+
if (config2.notificationSyncTitle != null) {
|
|
1035
|
+
merger.setNotificationSyncTitle(config2.getNotificationSyncTitle());
|
|
1036
|
+
}
|
|
1037
|
+
if (config2.notificationSyncText != null) {
|
|
1038
|
+
merger.setNotificationSyncText(config2.getNotificationSyncText());
|
|
1039
|
+
}
|
|
1040
|
+
if (config2.notificationSyncCompletedText != null) {
|
|
1041
|
+
merger.setNotificationSyncCompletedText(config2.getNotificationSyncCompletedText());
|
|
1042
|
+
}
|
|
1043
|
+
if (config2.notificationSyncFailedText != null) {
|
|
1044
|
+
merger.setNotificationSyncFailedText(config2.getNotificationSyncFailedText());
|
|
1045
|
+
}
|
|
1046
|
+
if (config2.hasStopOnTerminate()) {
|
|
1047
|
+
merger.setStopOnTerminate(config2.getStopOnTerminate());
|
|
1048
|
+
}
|
|
1049
|
+
if (config2.hasStartOnBoot()) {
|
|
1050
|
+
merger.setStartOnBoot(config2.getStartOnBoot());
|
|
1051
|
+
}
|
|
1052
|
+
if (config2.hasLocationProvider()) {
|
|
1053
|
+
merger.setLocationProvider(config2.getLocationProvider());
|
|
1054
|
+
}
|
|
1055
|
+
if (config2.hasInterval()) {
|
|
1056
|
+
merger.setInterval(config2.getInterval());
|
|
1057
|
+
}
|
|
1058
|
+
if (config2.hasFastestInterval()) {
|
|
1059
|
+
merger.setFastestInterval(config2.getFastestInterval());
|
|
1060
|
+
}
|
|
1061
|
+
if (config2.hasActivitiesInterval()) {
|
|
1062
|
+
merger.setActivitiesInterval(config2.getActivitiesInterval());
|
|
1063
|
+
}
|
|
1064
|
+
if (config2.hasNotificationIconColor()) {
|
|
1065
|
+
merger.setNotificationIconColor(config2.getNotificationIconColor());
|
|
1066
|
+
}
|
|
1067
|
+
if (config2.hasLargeNotificationIcon()) {
|
|
1068
|
+
merger.setLargeNotificationIcon(config2.getLargeNotificationIcon());
|
|
1069
|
+
}
|
|
1070
|
+
if (config2.hasSmallNotificationIcon()) {
|
|
1071
|
+
merger.setSmallNotificationIcon(config2.getSmallNotificationIcon());
|
|
1072
|
+
}
|
|
1073
|
+
if (config2.hasStartForeground()) {
|
|
1074
|
+
merger.setStartForeground(config2.getStartForeground());
|
|
1075
|
+
}
|
|
1076
|
+
if (config2.hasNotificationsEnabled()) {
|
|
1077
|
+
merger.setNotificationsEnabled(config2.getNotificationsEnabled());
|
|
1078
|
+
}
|
|
1079
|
+
if (config2.hasStopOnStillActivity()) {
|
|
1080
|
+
merger.setStopOnStillActivity(config2.getStopOnStillActivity());
|
|
1081
|
+
}
|
|
1082
|
+
if (config2.hasUrl()) {
|
|
1083
|
+
merger.setUrl(config2.getUrl());
|
|
1084
|
+
}
|
|
1085
|
+
if (config2.hasSyncUrl()) {
|
|
1086
|
+
merger.setSyncUrl(config2.getSyncUrl());
|
|
1087
|
+
}
|
|
1088
|
+
if (config2.hasSyncThreshold()) {
|
|
1089
|
+
merger.setSyncThreshold(config2.getSyncThreshold());
|
|
1090
|
+
}
|
|
1091
|
+
if (config2.hasSyncEnabled()) {
|
|
1092
|
+
merger.setSyncEnabled(config2.getSyncEnabled());
|
|
1093
|
+
}
|
|
1094
|
+
if (config2.hasHttpHeaders()) {
|
|
1095
|
+
merger.setHttpHeaders(config2.getHttpHeaders());
|
|
1096
|
+
}
|
|
1097
|
+
if (config2.hasMaxLocations()) {
|
|
1098
|
+
merger.setMaxLocations(config2.getMaxLocations());
|
|
1099
|
+
}
|
|
1100
|
+
if (config2.hasTemplate()) {
|
|
1101
|
+
merger.setTemplate(config2.getTemplate());
|
|
1102
|
+
}
|
|
1103
|
+
if (config2.hasShowTime()) {
|
|
1104
|
+
merger.setShowTime(config2.getShowTime());
|
|
1105
|
+
}
|
|
1106
|
+
if (config2.hasShowDistance()) {
|
|
1107
|
+
merger.setShowDistance(config2.getShowDistance());
|
|
1108
|
+
}
|
|
1109
|
+
if (config2.httpMethod != null) {
|
|
1110
|
+
merger.setHttpMethod(config2.getHttpMethod());
|
|
1111
|
+
}
|
|
1112
|
+
if (config2.syncHttpMethod != null) {
|
|
1113
|
+
merger.setSyncHttpMethod(config2.getSyncHttpMethod());
|
|
1114
|
+
}
|
|
1115
|
+
if (config2.httpMode != null) {
|
|
1116
|
+
merger.setHttpMode(config2.getHttpMode());
|
|
1117
|
+
}
|
|
1118
|
+
if (config2.syncMode != null) {
|
|
1119
|
+
merger.setSyncMode(config2.getSyncMode());
|
|
1120
|
+
}
|
|
1121
|
+
if (config2.hasQueryParams()) {
|
|
1122
|
+
merger.setQueryParams(config2.getQueryParams());
|
|
1123
|
+
}
|
|
1124
|
+
if (config2.heartbeatInterval != null) {
|
|
1125
|
+
merger.setHeartbeatInterval(config2.getHeartbeatInterval());
|
|
1126
|
+
}
|
|
1127
|
+
if (config2.mockLocationPolicy != null) {
|
|
1128
|
+
merger.setMockLocationPolicy(config2.getMockLocationPolicy());
|
|
1129
|
+
}
|
|
1130
|
+
if (config2.drivingEvents != null) {
|
|
1131
|
+
merger.setDrivingEvents(config2.drivingEvents);
|
|
1132
|
+
}
|
|
1133
|
+
// v4.4.1 — was missing: configure({includeBattery: false}) was being ignored.
|
|
1134
|
+
if (config2.includeBattery != null) {
|
|
1135
|
+
merger.setIncludeBattery(config2.getIncludeBattery());
|
|
1136
|
+
}
|
|
1137
|
+
// v4.5.1 — battery-saving knobs.
|
|
1138
|
+
if (config2.wakeLockMode != null) merger.setWakeLockMode(config2.wakeLockMode);
|
|
1139
|
+
if (config2.stationaryTimeout != null) merger.setStationaryTimeout(config2.stationaryTimeout);
|
|
1140
|
+
if (config2.stationaryPollInterval != null) merger.setStationaryPollInterval(config2.stationaryPollInterval);
|
|
1141
|
+
if (config2.stationaryPollFast != null) merger.setStationaryPollFast(config2.stationaryPollFast);
|
|
1142
|
+
// v4.5.2
|
|
1143
|
+
if (config2.activityConfidenceThreshold != null) merger.setActivityConfidenceThreshold(config2.activityConfidenceThreshold);
|
|
1144
|
+
if (config2.maxAcceptedAccuracy != null) merger.setMaxAcceptedAccuracy(config2.maxAcceptedAccuracy);
|
|
1145
|
+
|
|
1146
|
+
return merger;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
public static Config fromByteArray (byte[] byteArray) {
|
|
1150
|
+
Parcel parcel = Parcel.obtain();
|
|
1151
|
+
parcel.unmarshall(byteArray, 0, byteArray.length);
|
|
1152
|
+
parcel.setDataPosition(0);
|
|
1153
|
+
return Config.CREATOR.createFromParcel(parcel);
|
|
1154
|
+
}
|
|
1155
|
+
}
|