@josuelmm/cordova-background-geolocation 2.3.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.
- package/.npmignore +23 -0
- package/CHANGELOG.md +787 -0
- package/CONTRIBUTORS.md +15 -0
- package/HISTORY.md +734 -0
- package/LICENSE +191 -0
- package/README.md +125 -0
- package/RELEASE.MD +5 -0
- package/android/CDVBackgroundGeolocation/src/main/AndroidManifest.xml +23 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/HandlerWrapper.java +18 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/JavaScriptInterface.java +22 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/JsEvaluator.java +133 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/JsFunctionCallFormatter.java +37 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/WebViewWrapper.java +71 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/CallJavaResultInterface.java +8 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/HandlerWrapperInterface.java +5 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/JsCallback.java +10 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/JsEvaluatorInterface.java +18 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/WebViewWrapperInterface.java +14 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/ConfigMapper.java +148 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/PluginRegistry.java +25 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/headless/JsEvaluatorTaskRunner.java +53 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/tenforwardconsulting/bgloc/cordova/BackgroundGeolocationPlugin.java +603 -0
- package/android/CDVBackgroundGeolocation/src/main/res/values/strings.xml +4 -0
- package/android/CDVBackgroundGeolocation/src/test/java/com/marianhello/ConfigMapperTest.java +208 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java +45 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java +570 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/ConfigTest.java +76 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java +437 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java +95 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/LocationContentProviderTest.java +159 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java +161 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java +247 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java +200 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java +457 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java +96 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java +225 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/TestPluginDelegate.java +46 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/TestResourceResolver.java +14 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/provider/MockLocationProvider.java +50 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/provider/TestLocationProviderFactory.java +17 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/sqlite/SQLiteOpenHelper10.java +92 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/test/LocationProviderTestCase.java +107 -0
- package/android/common/src/androidTest/java/com/marianhello/bgloc/test/TestConstants.java +5 -0
- package/android/common/src/main/AndroidManifest.xml +72 -0
- package/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java +523 -0
- package/android/common/src/main/java/com/marianhello/bgloc/BootCompletedReceiver.java +59 -0
- package/android/common/src/main/java/com/marianhello/bgloc/Config.java +652 -0
- package/android/common/src/main/java/com/marianhello/bgloc/ConnectivityListener.java +5 -0
- package/android/common/src/main/java/com/marianhello/bgloc/HttpPostService.java +224 -0
- package/android/common/src/main/java/com/marianhello/bgloc/LocationManager.java +138 -0
- package/android/common/src/main/java/com/marianhello/bgloc/PluginDelegate.java +19 -0
- package/android/common/src/main/java/com/marianhello/bgloc/PluginException.java +38 -0
- package/android/common/src/main/java/com/marianhello/bgloc/PostLocationTask.java +188 -0
- package/android/common/src/main/java/com/marianhello/bgloc/ResourceResolver.java +55 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/AbstractLocationTemplate.java +69 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/ArrayListLocationTemplate.java +88 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundActivity.java +108 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java +994 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/ConfigurationDAO.java +13 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/DAOFactory.java +17 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/HashMapLocationTemplate.java +82 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/LocationDAO.java +22 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/LocationTemplate.java +12 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/LocationTemplateFactory.java +65 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java +19 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/provider/ContentProviderLocationDAO.java +395 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/provider/LocationContentProvider.java +321 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationContract.java +76 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationDAO.java +160 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationContract.java +112 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationDAO.java +506 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteOpenHelper.java +151 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/AbstractTaskRunner.java +15 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/ActivityTask.java +48 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/JsCallback.java +10 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/LocationTask.java +60 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/StationaryTask.java +25 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/Task.java +8 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/TaskRunner.java +5 -0
- package/android/common/src/main/java/com/marianhello/bgloc/headless/TaskRunnerFactory.java +8 -0
- package/android/common/src/main/java/com/marianhello/bgloc/provider/AbstractLocationProvider.java +171 -0
- package/android/common/src/main/java/com/marianhello/bgloc/provider/ActivityRecognitionLocationProvider.java +282 -0
- package/android/common/src/main/java/com/marianhello/bgloc/provider/DistanceFilterLocationProvider.java +610 -0
- package/android/common/src/main/java/com/marianhello/bgloc/provider/LocationProvider.java +32 -0
- package/android/common/src/main/java/com/marianhello/bgloc/provider/LocationProviderFactory.java +47 -0
- package/android/common/src/main/java/com/marianhello/bgloc/provider/ProviderDelegate.java +12 -0
- package/android/common/src/main/java/com/marianhello/bgloc/provider/RawLocationProvider.java +145 -0
- package/android/common/src/main/java/com/marianhello/bgloc/service/LocationService.java +16 -0
- package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java +749 -0
- package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceInfo.java +6 -0
- package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceInfoImpl.java +41 -0
- package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java +203 -0
- package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceProxy.java +130 -0
- package/android/common/src/main/java/com/marianhello/bgloc/sync/AccountHelper.java +39 -0
- package/android/common/src/main/java/com/marianhello/bgloc/sync/Authenticator.java +68 -0
- package/android/common/src/main/java/com/marianhello/bgloc/sync/AuthenticatorService.java +28 -0
- package/android/common/src/main/java/com/marianhello/bgloc/sync/BatchManager.java +278 -0
- package/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java +148 -0
- package/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java +249 -0
- package/android/common/src/main/java/com/marianhello/bgloc/sync/SyncService.java +68 -0
- package/android/common/src/main/java/com/marianhello/logging/DBLogReader.java +203 -0
- package/android/common/src/main/java/com/marianhello/logging/LogEntry.java +99 -0
- package/android/common/src/main/java/com/marianhello/logging/LoggerManager.java +70 -0
- package/android/common/src/main/java/com/marianhello/logging/UncaughtExceptionLogger.java +36 -0
- package/android/common/src/main/java/com/marianhello/utils/CloneHelper.java +22 -0
- package/android/common/src/main/java/com/marianhello/utils/Convert.java +56 -0
- package/android/common/src/main/java/com/marianhello/utils/TextUtils.java +72 -0
- package/android/common/src/main/java/com/marianhello/utils/ToneGenerator.java +68 -0
- package/android/common/src/main/java/org/apache/commons/io/Charsets.java +153 -0
- package/android/common/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java +344 -0
- package/android/common/src/main/java/org/chromium/content/browser/ThreadUtils.java +134 -0
- package/android/common/src/main/java/ru/andremoniy/sqlbuilder/SqlExpression.java +398 -0
- package/android/common/src/main/java/ru/andremoniy/sqlbuilder/SqlSelectStatement.java +671 -0
- package/android/common/src/main/java/ru/andremoniy/sqlbuilder/SqlStatement.java +29 -0
- package/android/common/src/main/java/ru/andremoniy/utils/TextUtils.java +61 -0
- package/android/common/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/common/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/common/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/common/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/common/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/common/src/main/res/values/strings.xml +4 -0
- package/android/common/src/main/res/xml/authenticator.xml +7 -0
- package/android/common/src/main/res/xml/syncadapter.xml +9 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/ArrayListLocationTemplateTest.java +82 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java +128 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java +191 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java +37 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/HashMapLocationTemplateTest.java +216 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/HttpPostServiceTest.java +223 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/LocationTemplateFactoryTest.java +50 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/PostLocationTaskTest.java +180 -0
- package/android/common/src/test/java/com/marianhello/backgroundgeolocation/TestHelper.java +16 -0
- package/android/dependencies.gradle +13 -0
- package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.h +41 -0
- package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.m +526 -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 +202 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.h +60 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.m +638 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundSync.h +34 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundSync.m +185 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.h +25 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.m +105 -0
- package/ios/common/BackgroundGeolocation/MAURConfig.h +74 -0
- package/ios/common/BackgroundGeolocation/MAURConfig.m +485 -0
- package/ios/common/BackgroundGeolocation/MAURConfigurationContract.h +49 -0
- package/ios/common/BackgroundGeolocation/MAURConfigurationContract.m +51 -0
- package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.h +20 -0
- package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.m +514 -0
- package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.h +17 -0
- package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.m +97 -0
- package/ios/common/BackgroundGeolocation/MAURLocation.h +59 -0
- package/ios/common/BackgroundGeolocation/MAURLocation.m +349 -0
- package/ios/common/BackgroundGeolocation/MAURLocationContract.h +34 -0
- package/ios/common/BackgroundGeolocation/MAURLocationContract.m +35 -0
- package/ios/common/BackgroundGeolocation/MAURLocationManager.h +53 -0
- package/ios/common/BackgroundGeolocation/MAURLocationManager.m +287 -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 +40 -0
- package/ios/common/BackgroundGeolocation/MAURPostLocationTask.m +250 -0
- package/ios/common/BackgroundGeolocation/MAURProviderDelegate.h +52 -0
- package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.h +18 -0
- package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.m +129 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.h +26 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.m +278 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.h +57 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.m +93 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.h +38 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.m +380 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.h +32 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.m +276 -0
- package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.h +20 -0
- package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.m +62 -0
- package/ios/common/BackgroundGeolocation/Reachability.h +102 -0
- package/ios/common/BackgroundGeolocation/Reachability.m +475 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/CHANGELOG.md +2 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/LICENSE +21 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/README.md +135 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOLocationManager.h +80 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOLocationManager.m +147 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionActivity.h +30 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionActivity.m +42 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionDetector.h +99 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionDetector.m +327 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOStepDetector.h +44 -0
- package/ios/common/BackgroundGeolocation/SOMotionDetector/SOStepDetector.m +94 -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.xcodeproj/project.pbxproj +760 -0
- package/ios/common/BackgroundGeolocationTests/Info.plist +24 -0
- package/ios/common/BackgroundGeolocationTests/MAURBackgroundLocationTest.m +185 -0
- package/ios/common/BackgroundGeolocationTests/MAURConfigTest.m +161 -0
- package/ios/common/BackgroundGeolocationTests/MAURGeolocationOpenHelperTest.m +102 -0
- package/ios/common/BackgroundGeolocationTests/MAURLocationTest.m +216 -0
- package/ios/common/BackgroundGeolocationTests/MAURLocationUploaderTest.m +55 -0
- package/ios/common/BackgroundGeolocationTests/MAURLogReaderTest.m +43 -0
- package/ios/common/BackgroundGeolocationTests/MAURSQLiteConfigurationDAOTest.m +102 -0
- package/ios/common/BackgroundGeolocationTests/MAURSQLiteHelperTest.m +41 -0
- package/ios/common/BackgroundGeolocationTests/MAURSQLiteLocationDAOTests.m +240 -0
- package/ios/common/BackgroundGeolocationTests/MAURSQLiteLocationDAOThreadTest.m +84 -0
- package/ios/common/BackgroundGeolocationTests/MAURSQLiteOpenHelperTest.m +144 -0
- package/ios/common/CONTRIBUTORS.md +10 -0
- package/ios/common/LICENSE +191 -0
- package/ios/common/README.md +7 -0
- package/ios/common/scripts/xcode-refactor.js +184 -0
- package/package.json +44 -0
- package/plugin.xml +355 -0
- package/www/BackgroundGeolocation.d.ts +910 -0
- package/www/BackgroundGeolocation.js +247 -0
- package/www/radio.js +177 -0
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
// Type definitions for @josuelmm/cordova-background-geolocation.
|
|
2
|
+
// Project: https://github.com/josuelmm/cordova-background-geolocation
|
|
3
|
+
// Definitions by: Mauron85 (@mauron85), Norbert Györög (@djereg)
|
|
4
|
+
// Definitions: https://github.com/josuelmm/cordova-background-geolocation/blob/master/www/BackgroundGeolocation.d.ts
|
|
5
|
+
|
|
6
|
+
type Event = 'location' | 'stationary' | 'activity' | 'start' | 'stop' | 'error' | 'authorization' | 'foreground' | 'background' | 'abort_requested' | 'http_authorization';
|
|
7
|
+
type HeadlessTaskEventName = 'location' | 'stationary' | 'activity';
|
|
8
|
+
type iOSActivityType = 'AutomotiveNavigation' | 'OtherNavigation' | 'Fitness' | 'Other';
|
|
9
|
+
type NativeProvider = 'gps' | 'network' | 'passive' | 'fused';
|
|
10
|
+
type ActivityType = 'IN_VEHICLE' | 'ON_BICYCLE' | 'ON_FOOT' | 'RUNNING' | 'STILL' | 'TILTING' | 'UNKNOWN' | 'WALKING';
|
|
11
|
+
type LogLevel = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
12
|
+
type LocationProvider = 0 | 1 | 2;
|
|
13
|
+
type AuthorizationStatus = 0 | 1 | 2;
|
|
14
|
+
type AccuracyLevel = 0 | 100 | 1000 | 10000 | number;
|
|
15
|
+
type LocationErrorCode = 1 | 2 | 3;
|
|
16
|
+
type ServiceMode = 0 | 1;
|
|
17
|
+
|
|
18
|
+
export interface Unsubscribable {
|
|
19
|
+
unsubscribe(): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Subscribable<T> {
|
|
23
|
+
subscribe(callback: (value: T) => any): Unsubscribable;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ConfigureOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Set location provider
|
|
29
|
+
*
|
|
30
|
+
* Platform: all
|
|
31
|
+
* Available providers:
|
|
32
|
+
* DISTANCE_FILTER_PROVIDER,
|
|
33
|
+
* ACTIVITY_PROVIDER
|
|
34
|
+
* RAW_PROVIDER
|
|
35
|
+
*
|
|
36
|
+
* @default DISTANCE_FILTER_PROVIDER
|
|
37
|
+
* @example
|
|
38
|
+
* { locationProvider: BackgroundGeolocation.RAW_PROVIDER }
|
|
39
|
+
*/
|
|
40
|
+
locationProvider?: LocationProvider;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Desired accuracy in meters.
|
|
44
|
+
*
|
|
45
|
+
* Platform: all
|
|
46
|
+
* Provider: all
|
|
47
|
+
* Possible values:
|
|
48
|
+
* HIGH_ACCURACY,
|
|
49
|
+
* MEDIUM_ACCURACY,
|
|
50
|
+
* LOW_ACCURACY,
|
|
51
|
+
* PASSIVE_ACCURACY
|
|
52
|
+
* Note: Accuracy has direct effect on power drain. Lower accuracy = lower power drain.
|
|
53
|
+
*
|
|
54
|
+
* @default MEDIUM_ACCURACY
|
|
55
|
+
* @example
|
|
56
|
+
* { desiredAccuracy: BackgroundGeolocation.LOW_ACCURACY }
|
|
57
|
+
*/
|
|
58
|
+
desiredAccuracy?: AccuracyLevel;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Stationary radius in meters.
|
|
62
|
+
*
|
|
63
|
+
* When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage.
|
|
64
|
+
* Platform: all
|
|
65
|
+
* Provider: DISTANCE_FILTER
|
|
66
|
+
*
|
|
67
|
+
* @default 50
|
|
68
|
+
*/
|
|
69
|
+
stationaryRadius?: number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* When enabled, the plugin will emit sounds for life-cycle events of background-geolocation! See debugging sounds table.
|
|
73
|
+
*
|
|
74
|
+
* Platform: all
|
|
75
|
+
* Provider: all
|
|
76
|
+
*
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
debug?: boolean;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The minimum distance (measured in meters) a device must move horizontally before an update event is generated.
|
|
83
|
+
*
|
|
84
|
+
* Platform: all
|
|
85
|
+
* Provider: DISTANCE_FILTER, RAW
|
|
86
|
+
*
|
|
87
|
+
* @default 500
|
|
88
|
+
* @see {@link https://apple.co/2oHo2CV|Apple docs}
|
|
89
|
+
*/
|
|
90
|
+
distanceFilter?: number;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Enable this in order to force a stop() when the application terminated.
|
|
94
|
+
* E.g. on iOS, double-tap home button, swipe away the app.
|
|
95
|
+
*
|
|
96
|
+
* Platform: all
|
|
97
|
+
* Provider: all
|
|
98
|
+
*
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
stopOnTerminate?: boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Start background service on device boot.
|
|
105
|
+
*
|
|
106
|
+
* Platform: Android
|
|
107
|
+
* Provider: all
|
|
108
|
+
*
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
startOnBoot?: boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The minimum time interval between location updates in milliseconds.
|
|
115
|
+
*
|
|
116
|
+
* Platform: Android
|
|
117
|
+
* Provider: all
|
|
118
|
+
*
|
|
119
|
+
* @default 60000
|
|
120
|
+
* @see {@link https://bit.ly/1x00RUu|Android docs}
|
|
121
|
+
*/
|
|
122
|
+
interval?: number;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Fastest rate in milliseconds at which your app can handle location updates.
|
|
126
|
+
*
|
|
127
|
+
* Platform: Android
|
|
128
|
+
* Provider: ACTIVITY
|
|
129
|
+
*
|
|
130
|
+
* @default 120000
|
|
131
|
+
* @see {@link https://bit.ly/1x00RUu|Android docs}
|
|
132
|
+
*/
|
|
133
|
+
fastestInterval?: number;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Rate in milliseconds at which activity recognition occurs.
|
|
137
|
+
* Larger values will result in fewer activity detections while improving battery life.
|
|
138
|
+
*
|
|
139
|
+
* Platform: Android
|
|
140
|
+
* Provider: ACTIVITY
|
|
141
|
+
*
|
|
142
|
+
* @default 10000
|
|
143
|
+
*/
|
|
144
|
+
activitiesInterval?: number;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated Stop location updates, when the STILL activity is detected.
|
|
148
|
+
*/
|
|
149
|
+
stopOnStillActivity?: boolean;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Enable/disable local notifications when tracking and syncing locations.
|
|
153
|
+
*
|
|
154
|
+
* Platform: Android
|
|
155
|
+
* Provider: all
|
|
156
|
+
*
|
|
157
|
+
* @default true
|
|
158
|
+
*/
|
|
159
|
+
notificationsEnabled?: boolean;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Allow location sync service to run in foreground state.
|
|
163
|
+
* Foreground state also requires a notification to be presented to the user.
|
|
164
|
+
*
|
|
165
|
+
* Platform: Android
|
|
166
|
+
* Provider: all
|
|
167
|
+
*
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
startForeground?: boolean;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Custom notification title in the drawer.
|
|
174
|
+
*
|
|
175
|
+
* Platform: Android
|
|
176
|
+
* Provider: all
|
|
177
|
+
|
|
178
|
+
* @default "Background tracking"
|
|
179
|
+
*/
|
|
180
|
+
notificationTitle?: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Custom notification text in the drawer.
|
|
184
|
+
*
|
|
185
|
+
* Platform: Android
|
|
186
|
+
* Provider: all
|
|
187
|
+
*
|
|
188
|
+
* @default "ENABLED"
|
|
189
|
+
*/
|
|
190
|
+
notificationText?: string;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The accent color (hex triplet) to use for notification.
|
|
194
|
+
* Eg. <code>#4CAF50</code>.
|
|
195
|
+
*
|
|
196
|
+
* Platform: Android
|
|
197
|
+
* Provider: all
|
|
198
|
+
*/
|
|
199
|
+
notificationIconColor?: string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The filename of a custom notification icon.
|
|
203
|
+
*
|
|
204
|
+
* Platform: Android
|
|
205
|
+
* Provider: all
|
|
206
|
+
*/
|
|
207
|
+
notificationIconLarge?: string;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The filename of a custom notification icon.
|
|
211
|
+
*
|
|
212
|
+
* Platform: Android
|
|
213
|
+
* Provider: all
|
|
214
|
+
*/
|
|
215
|
+
notificationIconSmall?: string;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Activity type.
|
|
219
|
+
* Presumably, this affects iOS GPS algorithm.
|
|
220
|
+
*
|
|
221
|
+
* Possible values:
|
|
222
|
+
* "AutomotiveNavigation", "OtherNavigation", "Fitness", "Other"
|
|
223
|
+
*
|
|
224
|
+
* Platform: iOS
|
|
225
|
+
* Provider: all
|
|
226
|
+
*
|
|
227
|
+
* @default "OtherNavigation"
|
|
228
|
+
* @see {@link https://apple.co/2oHofpH|Apple docs}
|
|
229
|
+
*/
|
|
230
|
+
activityType?: iOSActivityType;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Pauses location updates when app is paused.
|
|
234
|
+
*
|
|
235
|
+
* Platform: iOS
|
|
236
|
+
* Provider: all
|
|
237
|
+
*
|
|
238
|
+
* @default false
|
|
239
|
+
* @see {@link https://apple.co/2CbjEW2|Apple docs}
|
|
240
|
+
*/
|
|
241
|
+
pauseLocationUpdates?: boolean;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Switch to less accurate significant changes and region monitory when in background.
|
|
245
|
+
*
|
|
246
|
+
* Platform: iOS
|
|
247
|
+
* Provider: all
|
|
248
|
+
*
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
saveBatteryOnBackground?: boolean;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Server url where to send HTTP POST with recorded locations
|
|
255
|
+
*
|
|
256
|
+
* Platform: all
|
|
257
|
+
* Provider: all
|
|
258
|
+
*/
|
|
259
|
+
url?: string;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Server url where to send fail to post locations
|
|
263
|
+
*
|
|
264
|
+
* Platform: all
|
|
265
|
+
* Provider: all
|
|
266
|
+
*/
|
|
267
|
+
syncUrl?: string;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Specifies how many previously failed locations will be sent to server at once.
|
|
271
|
+
*
|
|
272
|
+
* Platform: all
|
|
273
|
+
* Provider: all
|
|
274
|
+
*
|
|
275
|
+
* @default 100
|
|
276
|
+
*/
|
|
277
|
+
syncThreshold?: string;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Optional HTTP headers sent along in HTTP request.
|
|
281
|
+
*
|
|
282
|
+
* Platform: all
|
|
283
|
+
* Provider: all
|
|
284
|
+
*/
|
|
285
|
+
httpHeaders?: any;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Limit maximum number of locations stored into db.
|
|
289
|
+
*
|
|
290
|
+
* Platform: all
|
|
291
|
+
* Provider: all
|
|
292
|
+
*
|
|
293
|
+
* @default 10000
|
|
294
|
+
*/
|
|
295
|
+
maxLocations?: number;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Customization post template.
|
|
299
|
+
*
|
|
300
|
+
* Platform: all
|
|
301
|
+
* Provider: all
|
|
302
|
+
*/
|
|
303
|
+
postTemplate?: any;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface LocationOptions {
|
|
307
|
+
/**
|
|
308
|
+
* Maximum time in milliseconds device will wait for location.
|
|
309
|
+
*/
|
|
310
|
+
timeout?: number;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Maximum age in milliseconds of a possible cached location that is acceptable to return.
|
|
314
|
+
*/
|
|
315
|
+
maximumAge?: number;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* If true and if the device is able to provide a more accurate position, it will do so.
|
|
319
|
+
*/
|
|
320
|
+
enableHighAccuracy?: boolean;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface Location {
|
|
324
|
+
/** ID of location as stored in DB (or null) */
|
|
325
|
+
id: number;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Native provider reponsible for location.
|
|
329
|
+
*
|
|
330
|
+
* Possible values:
|
|
331
|
+
* "gps", "network", "passive" or "fused"
|
|
332
|
+
*/
|
|
333
|
+
provider: NativeProvider;
|
|
334
|
+
|
|
335
|
+
/** Configured location provider. */
|
|
336
|
+
locationProvider: number;
|
|
337
|
+
|
|
338
|
+
/** UTC time of this fix, in milliseconds since January 1, 1970. */
|
|
339
|
+
time: number;
|
|
340
|
+
|
|
341
|
+
/** Latitude, in degrees. */
|
|
342
|
+
latitude: number;
|
|
343
|
+
|
|
344
|
+
/** Longitude, in degrees. */
|
|
345
|
+
longitude: number;
|
|
346
|
+
|
|
347
|
+
/** Estimated accuracy of this location, in meters. */
|
|
348
|
+
accuracy: number;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Speed if it is available, in meters/second over ground.
|
|
352
|
+
*
|
|
353
|
+
* Note: Not all providers are capable of providing speed.
|
|
354
|
+
* Typically network providers are not able to do so.
|
|
355
|
+
*/
|
|
356
|
+
speed: number;
|
|
357
|
+
|
|
358
|
+
/** Altitude if available, in meters above the WGS 84 reference ellipsoid. */
|
|
359
|
+
altitude: number;
|
|
360
|
+
|
|
361
|
+
/** Bearing, in degrees. */
|
|
362
|
+
bearing: number;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* True if location was recorded by mock provider. (ANDROID ONLY)
|
|
366
|
+
*
|
|
367
|
+
* Note: this property is not enabled by default!
|
|
368
|
+
* You can enable it "postTemplate" configure option.
|
|
369
|
+
*/
|
|
370
|
+
isFromMockProvider?: boolean;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* True if device has mock locations enabled. (ANDROID ONLY)
|
|
374
|
+
*
|
|
375
|
+
* Note: this property is not enabled by default!
|
|
376
|
+
* You can enable it "postTemplate" configure option.
|
|
377
|
+
*/
|
|
378
|
+
mockLocationsEnabled?: boolean;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export interface StationaryLocation extends Location {
|
|
382
|
+
radius: number
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface LocationError {
|
|
386
|
+
/**
|
|
387
|
+
* Reason of an error occurring when using the geolocating device.
|
|
388
|
+
*
|
|
389
|
+
* Possible error codes:
|
|
390
|
+
* 1. PERMISSION_DENIED
|
|
391
|
+
* 2. LOCATION_UNAVAILABLE
|
|
392
|
+
* 3. TIMEOUT
|
|
393
|
+
*/
|
|
394
|
+
code: LocationErrorCode;
|
|
395
|
+
|
|
396
|
+
/** Message describing the details of the error */
|
|
397
|
+
message: string;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface BackgroundGeolocationError {
|
|
401
|
+
code: number;
|
|
402
|
+
message: string;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface Activity {
|
|
406
|
+
/** Percentage indicating the likelihood user is performing this activity. */
|
|
407
|
+
confidence: number;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Type of the activity.
|
|
411
|
+
*
|
|
412
|
+
* Possible values:
|
|
413
|
+
* IN_VEHICLE, ON_BICYCLE, ON_FOOT, RUNNING, STILL, TILTING, UNKNOWN, WALKING
|
|
414
|
+
*/
|
|
415
|
+
type: ActivityType;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export interface ServiceStatus {
|
|
419
|
+
/** TRUE if service is running. */
|
|
420
|
+
isRunning: boolean;
|
|
421
|
+
|
|
422
|
+
/** TRUE if location services are enabled */
|
|
423
|
+
locationServicesEnabled: boolean;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Authorization status.
|
|
427
|
+
*
|
|
428
|
+
* Posible values:
|
|
429
|
+
* NOT_AUTHORIZED, AUTHORIZED, AUTHORIZED_FOREGROUND
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* if (authorization == BackgroundGeolocation.NOT_AUTHORIZED) {...}
|
|
433
|
+
*/
|
|
434
|
+
authorization: AuthorizationStatus;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export interface LogEntry {
|
|
438
|
+
/** ID of log entry as stored in db. */
|
|
439
|
+
id: number;
|
|
440
|
+
|
|
441
|
+
/** Timestamp in milliseconds since beginning of UNIX epoch. */
|
|
442
|
+
timestamp: number;
|
|
443
|
+
|
|
444
|
+
/** Log level */
|
|
445
|
+
level: LogLevel;
|
|
446
|
+
|
|
447
|
+
/** Log message */
|
|
448
|
+
message: string;
|
|
449
|
+
|
|
450
|
+
/** Recorded stacktrace. (Android only, on iOS part of message) */
|
|
451
|
+
stackTrace: string;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export interface EventSubscription {
|
|
455
|
+
remove(): void;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export interface HeadlessTaskEvent {
|
|
459
|
+
/** Name of the event [ "location", "stationary", "activity" ] */
|
|
460
|
+
name: HeadlessTaskEventName;
|
|
461
|
+
|
|
462
|
+
/** Event parameters. */
|
|
463
|
+
params: any;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export interface BackgroundGeolocationPlugin {
|
|
467
|
+
|
|
468
|
+
DISTANCE_FILTER_PROVIDER: LocationProvider;
|
|
469
|
+
ACTIVITY_PROVIDER: LocationProvider;
|
|
470
|
+
RAW_PROVIDER: LocationProvider;
|
|
471
|
+
|
|
472
|
+
BACKGROUND_MODE: ServiceMode;
|
|
473
|
+
FOREGROUND_MODE: ServiceMode;
|
|
474
|
+
|
|
475
|
+
NOT_AUTHORIZED: AuthorizationStatus;
|
|
476
|
+
AUTHORIZED: AuthorizationStatus;
|
|
477
|
+
AUTHORIZED_FOREGROUND: AuthorizationStatus;
|
|
478
|
+
|
|
479
|
+
HIGH_ACCURACY: AccuracyLevel;
|
|
480
|
+
MEDIUM_ACCURACY: AccuracyLevel;
|
|
481
|
+
LOW_ACCURACY: AccuracyLevel;
|
|
482
|
+
PASSIVE_ACCURACY: AccuracyLevel;
|
|
483
|
+
|
|
484
|
+
LOG_ERROR: LogLevel;
|
|
485
|
+
LOG_WARN: LogLevel;
|
|
486
|
+
LOG_INFO: LogLevel;
|
|
487
|
+
LOG_DEBUG: LogLevel;
|
|
488
|
+
LOG_TRACE: LogLevel;
|
|
489
|
+
|
|
490
|
+
PERMISSION_DENIED: LocationErrorCode;
|
|
491
|
+
LOCATION_UNAVAILABLE: LocationErrorCode;
|
|
492
|
+
TIMEOUT: LocationErrorCode;
|
|
493
|
+
|
|
494
|
+
events: Event[];
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Configure plugin.
|
|
498
|
+
* Platform: iOS, Android
|
|
499
|
+
*
|
|
500
|
+
* @param options
|
|
501
|
+
* @param success
|
|
502
|
+
* @param fail
|
|
503
|
+
*/
|
|
504
|
+
configure(
|
|
505
|
+
options: ConfigureOptions,
|
|
506
|
+
success?: () => void,
|
|
507
|
+
fail?: () => void
|
|
508
|
+
): Promise<void>;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Start background geolocation.
|
|
512
|
+
* Platform: iOS, Android
|
|
513
|
+
*/
|
|
514
|
+
start(): Promise<void>;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Stop background geolocation.
|
|
518
|
+
* Platform: iOS, Android
|
|
519
|
+
*/
|
|
520
|
+
stop(): Promise<void>;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* One time location check to get current location of the device.
|
|
524
|
+
*
|
|
525
|
+
* Platform: all
|
|
526
|
+
*
|
|
527
|
+
* @param success
|
|
528
|
+
* @param fail
|
|
529
|
+
* @param options
|
|
530
|
+
*/
|
|
531
|
+
getCurrentLocation(
|
|
532
|
+
success?: (location: Location) => void,
|
|
533
|
+
fail?: (error: LocationError) => void | null,
|
|
534
|
+
options?: LocationOptions
|
|
535
|
+
): Promise<Location>;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Returns current stationaryLocation if available. Null if not
|
|
539
|
+
*
|
|
540
|
+
* Platform: all
|
|
541
|
+
*
|
|
542
|
+
* @param success
|
|
543
|
+
* @param fail
|
|
544
|
+
*/
|
|
545
|
+
getStationaryLocation(
|
|
546
|
+
success?: (location: StationaryLocation | null) => void,
|
|
547
|
+
fail?: (error: BackgroundGeolocationError) => void,
|
|
548
|
+
): Promise<StationaryLocation>;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Check status of the service
|
|
552
|
+
*
|
|
553
|
+
* @param success
|
|
554
|
+
* @param fail
|
|
555
|
+
*/
|
|
556
|
+
checkStatus(
|
|
557
|
+
success?: (status: ServiceStatus) => void,
|
|
558
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
559
|
+
): Promise<ServiceStatus>;
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Show app settings to allow change of app location permissions.
|
|
563
|
+
*
|
|
564
|
+
* Platform: Android >= 6, iOS >= 8.0
|
|
565
|
+
*/
|
|
566
|
+
showAppSettings(): Promise<void>;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Show system settings to allow configuration of current location sources.
|
|
570
|
+
*
|
|
571
|
+
* Platform: Android
|
|
572
|
+
*/
|
|
573
|
+
showLocationSettings(): Promise<void>;
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Return all stored locations.
|
|
577
|
+
* Useful for initial rendering of user location on a map just after application launch.
|
|
578
|
+
*
|
|
579
|
+
* Platform: iOS, Android
|
|
580
|
+
*
|
|
581
|
+
* @param success
|
|
582
|
+
* @param fail
|
|
583
|
+
*/
|
|
584
|
+
getLocations(
|
|
585
|
+
success?: (locations: Location[]) => void,
|
|
586
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
587
|
+
): Promise<Location[]>;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Method will return locations which have not yet been posted to server.
|
|
591
|
+
* Platform: iOS, Android
|
|
592
|
+
* @param success
|
|
593
|
+
* @param fail
|
|
594
|
+
*/
|
|
595
|
+
getValidLocations(
|
|
596
|
+
success?: (location: Location[]) => void,
|
|
597
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
598
|
+
): Promise<Location[]>;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Method will return locations which have not yet been posted to server and delete to avoid getting them again.
|
|
602
|
+
* Platform: iOS, Android
|
|
603
|
+
* @param success
|
|
604
|
+
* @param fail
|
|
605
|
+
*/
|
|
606
|
+
getValidLocationsAndDelete(
|
|
607
|
+
success?: (location: Location[]) => void,
|
|
608
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
609
|
+
): Promise<Location[]>;
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Delete location by locationId.
|
|
613
|
+
*
|
|
614
|
+
* Platform: iOS, Android
|
|
615
|
+
*
|
|
616
|
+
* @param locationId
|
|
617
|
+
* @param success
|
|
618
|
+
* @param fail
|
|
619
|
+
*/
|
|
620
|
+
deleteLocation(
|
|
621
|
+
locationId: number,
|
|
622
|
+
success?: () => void,
|
|
623
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
624
|
+
): Promise<void>;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Delete all stored locations.
|
|
628
|
+
*
|
|
629
|
+
* Platform: iOS, Android
|
|
630
|
+
*
|
|
631
|
+
* Note: You don't need to delete all locations.
|
|
632
|
+
* The plugin manages the number of stored locations automatically and the total count never exceeds the number as defined by <code>option.maxLocations</code>.
|
|
633
|
+
*
|
|
634
|
+
* @param success
|
|
635
|
+
* @param fail
|
|
636
|
+
*/
|
|
637
|
+
deleteAllLocations(
|
|
638
|
+
success?: () => void,
|
|
639
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
640
|
+
): Promise<void>;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Switch plugin operation mode,
|
|
644
|
+
*
|
|
645
|
+
* Platform: iOS
|
|
646
|
+
*
|
|
647
|
+
* Normally the plugin will handle switching between <b>BACKGROUND</b> and <b>FOREGROUND</b> mode itself.
|
|
648
|
+
* Calling <code>switchMode</code> you can override plugin behavior and force it to switch into other mode.
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* // switch to FOREGROUND mode
|
|
652
|
+
* BackgroundGeolocation.switchMode(BackgroundGeolocation.FOREGROUND_MODE);
|
|
653
|
+
*
|
|
654
|
+
* // switch to BACKGROUND mode
|
|
655
|
+
* BackgroundGeolocation.switchMode(BackgroundGeolocation.BACKGROUND_MODE);
|
|
656
|
+
*/
|
|
657
|
+
switchMode(
|
|
658
|
+
modeId: ServiceMode,
|
|
659
|
+
success?: () => void,
|
|
660
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
661
|
+
): Promise<void>;
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Force sync of pending locations.
|
|
665
|
+
* Option <code>syncThreshold</code> will be ignored and all pending locations will be immediately posted to <code>syncUrl</code> in single batch.
|
|
666
|
+
*
|
|
667
|
+
* Platform: Android, iOS
|
|
668
|
+
*
|
|
669
|
+
* @param success
|
|
670
|
+
* @param fail
|
|
671
|
+
*/
|
|
672
|
+
forceSync(
|
|
673
|
+
success?: () => void,
|
|
674
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
675
|
+
): Promise<void>;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Get stored configuration options.
|
|
679
|
+
*
|
|
680
|
+
* @param success
|
|
681
|
+
* @param fail
|
|
682
|
+
*/
|
|
683
|
+
getConfig(
|
|
684
|
+
success?: (options: ConfigureOptions) => void,
|
|
685
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
686
|
+
): Promise<ConfigureOptions>;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Return all logged events. Useful for plugin debugging.
|
|
690
|
+
*
|
|
691
|
+
* Platform: Android, iOS
|
|
692
|
+
*
|
|
693
|
+
* @param limit Limits number of returned entries.
|
|
694
|
+
* @param fromId Return entries after <code>fromId</code>. Useful if you plan to implement infinite log scrolling
|
|
695
|
+
* @param minLevel Available levels: ["TRACE", "DEBUG", "INFO", "WARN", "ERROR"]
|
|
696
|
+
* @param success
|
|
697
|
+
* @param fail
|
|
698
|
+
*/
|
|
699
|
+
getLogEntries(
|
|
700
|
+
limit: number,
|
|
701
|
+
fromId: number,
|
|
702
|
+
minLevel: LogLevel,
|
|
703
|
+
success?: (entries: LogEntry[]) => void,
|
|
704
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
705
|
+
): Promise<LogEntry[]>;
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Unregister all event listeners for given event.
|
|
709
|
+
*
|
|
710
|
+
* If parameter <code>event</code> is not provided then all event listeners will be removed.
|
|
711
|
+
*
|
|
712
|
+
* @param event
|
|
713
|
+
*/
|
|
714
|
+
removeAllListeners(event?: Event): void;
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Start background task (iOS only)
|
|
719
|
+
*
|
|
720
|
+
* To perform any long running operation on iOS
|
|
721
|
+
* you need to create background task
|
|
722
|
+
* IMPORTANT: task has to be ended by endTask
|
|
723
|
+
*
|
|
724
|
+
* @param success
|
|
725
|
+
* @param fail
|
|
726
|
+
*/
|
|
727
|
+
startTask(
|
|
728
|
+
success?: (taskKey: number) => void,
|
|
729
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
730
|
+
): Promise<number>;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* End background task indentified by taskKey (iOS only)
|
|
734
|
+
*
|
|
735
|
+
* @param taskKey
|
|
736
|
+
* @param success
|
|
737
|
+
* @param fail
|
|
738
|
+
*/
|
|
739
|
+
endTask(
|
|
740
|
+
taskKey: number,
|
|
741
|
+
success?: () => void,
|
|
742
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
743
|
+
): Promise<void>;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* A special task that gets executed when the app is terminated, but
|
|
747
|
+
* the plugin was configured to continue running in the background
|
|
748
|
+
* (option <code>stopOnTerminate: false</code>).
|
|
749
|
+
*
|
|
750
|
+
* In this scenario the Activity was killed by the system and all registered
|
|
751
|
+
* event listeners will not be triggered until the app is relaunched.
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* BackgroundGeolocation.headlessTask(function(event) {
|
|
755
|
+
*
|
|
756
|
+
* if (event.name === 'location' || event.name === 'stationary') {
|
|
757
|
+
* var xhr = new XMLHttpRequest();
|
|
758
|
+
* xhr.open('POST', 'http://192.168.81.14:3000/headless');
|
|
759
|
+
* xhr.setRequestHeader('Content-Type', 'application/json');
|
|
760
|
+
* xhr.send(JSON.stringify(event.params));
|
|
761
|
+
* }
|
|
762
|
+
*
|
|
763
|
+
* return 'Processing event: ' + event.name; // will be logged
|
|
764
|
+
* });
|
|
765
|
+
*/
|
|
766
|
+
headlessTask(
|
|
767
|
+
task: (event: HeadlessTaskEvent) => void
|
|
768
|
+
): void;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Register location event listener.
|
|
772
|
+
*
|
|
773
|
+
* @param eventName
|
|
774
|
+
* @param callback
|
|
775
|
+
*/
|
|
776
|
+
on(
|
|
777
|
+
eventName: 'location',
|
|
778
|
+
callback?: (location: Location) => void
|
|
779
|
+
): Subscribable<Location>;
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Register stationary location event listener.
|
|
783
|
+
*
|
|
784
|
+
* @param eventName
|
|
785
|
+
* @param callback
|
|
786
|
+
*/
|
|
787
|
+
on(
|
|
788
|
+
eventName: 'stationary',
|
|
789
|
+
callback?: (location: StationaryLocation) => void
|
|
790
|
+
): Subscribable<StationaryLocation>;
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Register activity monitoring listener.
|
|
794
|
+
*
|
|
795
|
+
* @param eventName
|
|
796
|
+
* @param callback
|
|
797
|
+
*/
|
|
798
|
+
on(
|
|
799
|
+
eventName: 'activity',
|
|
800
|
+
callback?: (activity: Activity) => void
|
|
801
|
+
): Subscribable<Activity>;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Register start event listener.
|
|
805
|
+
*
|
|
806
|
+
* Event is triggered when background service has been started succesfully.
|
|
807
|
+
*
|
|
808
|
+
* @param eventName
|
|
809
|
+
* @param callback
|
|
810
|
+
*/
|
|
811
|
+
on(
|
|
812
|
+
eventName: 'start',
|
|
813
|
+
callback?: () => void
|
|
814
|
+
): Subscribable<void>;
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Register stop event listener.
|
|
818
|
+
*
|
|
819
|
+
* Triggered when background service has been stopped succesfully.
|
|
820
|
+
*
|
|
821
|
+
* @param eventName
|
|
822
|
+
* @param callback
|
|
823
|
+
*/
|
|
824
|
+
on(
|
|
825
|
+
eventName: 'stop',
|
|
826
|
+
callback?: () => void
|
|
827
|
+
): Subscribable<void>;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Register error listener.
|
|
831
|
+
*
|
|
832
|
+
* @param eventName
|
|
833
|
+
* @param callback
|
|
834
|
+
*/
|
|
835
|
+
on(
|
|
836
|
+
eventName: 'error',
|
|
837
|
+
callback?: (error: BackgroundGeolocationError) => void
|
|
838
|
+
): Subscribable<BackgroundGeolocationError>;
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Register authorization listener.
|
|
842
|
+
*
|
|
843
|
+
* Triggered when user changes authorization/permissions for
|
|
844
|
+
* the app or toggles location services.
|
|
845
|
+
*
|
|
846
|
+
* @param eventName
|
|
847
|
+
* @param callback
|
|
848
|
+
*/
|
|
849
|
+
on(
|
|
850
|
+
eventName: 'authorization',
|
|
851
|
+
callback?: (status: AuthorizationStatus) => void
|
|
852
|
+
): Subscribable<AuthorizationStatus>;
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Register foreground event listener.
|
|
856
|
+
*
|
|
857
|
+
* Triggered when app entered foreground state and (visible to the user).
|
|
858
|
+
*
|
|
859
|
+
* @param eventName
|
|
860
|
+
* @param callback
|
|
861
|
+
*/
|
|
862
|
+
on(
|
|
863
|
+
eventName: 'foreground',
|
|
864
|
+
callback?: () => void
|
|
865
|
+
): Subscribable<void>;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Register background event listener.
|
|
869
|
+
*
|
|
870
|
+
* Triggered when app entered background state and (not visible to the user).
|
|
871
|
+
*
|
|
872
|
+
* @param eventName
|
|
873
|
+
* @param callback
|
|
874
|
+
*/
|
|
875
|
+
on(
|
|
876
|
+
eventName: 'background',
|
|
877
|
+
callback?: () => void
|
|
878
|
+
): Subscribable<void>;
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* Register abort_requested event listener.
|
|
882
|
+
*
|
|
883
|
+
* Triggered when server responded with "<code>285 Updates Not Required</code>" to post/sync request.
|
|
884
|
+
*
|
|
885
|
+
* @param eventName
|
|
886
|
+
* @param callback
|
|
887
|
+
*/
|
|
888
|
+
on(
|
|
889
|
+
eventName: 'abort_requested',
|
|
890
|
+
callback?: () => void
|
|
891
|
+
): Subscribable<void>;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Register http_authorization event listener.
|
|
895
|
+
*
|
|
896
|
+
* Triggered when server responded with "<code>401 Unauthorized</code>" to post/sync request.
|
|
897
|
+
*
|
|
898
|
+
* @param eventName
|
|
899
|
+
* @param callback
|
|
900
|
+
*/
|
|
901
|
+
on(
|
|
902
|
+
eventName: 'http_authorization',
|
|
903
|
+
callback?: () => void
|
|
904
|
+
): Subscribable<void>;
|
|
905
|
+
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
declare const BackgroundGeolocation: BackgroundGeolocationPlugin;
|
|
909
|
+
|
|
910
|
+
export default BackgroundGeolocation;
|