@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.
Files changed (239) hide show
  1. package/.npmignore +23 -0
  2. package/CHANGELOG.md +787 -0
  3. package/CONTRIBUTORS.md +15 -0
  4. package/HISTORY.md +734 -0
  5. package/LICENSE +191 -0
  6. package/README.md +125 -0
  7. package/RELEASE.MD +5 -0
  8. package/android/CDVBackgroundGeolocation/src/main/AndroidManifest.xml +23 -0
  9. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/HandlerWrapper.java +18 -0
  10. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/JavaScriptInterface.java +22 -0
  11. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/JsEvaluator.java +133 -0
  12. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/JsFunctionCallFormatter.java +37 -0
  13. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/WebViewWrapper.java +71 -0
  14. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/CallJavaResultInterface.java +8 -0
  15. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/HandlerWrapperInterface.java +5 -0
  16. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/JsCallback.java +10 -0
  17. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/JsEvaluatorInterface.java +18 -0
  18. package/android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/interfaces/WebViewWrapperInterface.java +14 -0
  19. package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/ConfigMapper.java +148 -0
  20. package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/PluginRegistry.java +25 -0
  21. package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/headless/JsEvaluatorTaskRunner.java +53 -0
  22. package/android/CDVBackgroundGeolocation/src/main/java/com/tenforwardconsulting/bgloc/cordova/BackgroundGeolocationPlugin.java +603 -0
  23. package/android/CDVBackgroundGeolocation/src/main/res/values/strings.xml +4 -0
  24. package/android/CDVBackgroundGeolocation/src/test/java/com/marianhello/ConfigMapperTest.java +208 -0
  25. package/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java +45 -0
  26. package/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java +570 -0
  27. package/android/common/src/androidTest/java/com/marianhello/bgloc/ConfigTest.java +76 -0
  28. package/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java +437 -0
  29. package/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java +95 -0
  30. package/android/common/src/androidTest/java/com/marianhello/bgloc/LocationContentProviderTest.java +159 -0
  31. package/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java +161 -0
  32. package/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java +247 -0
  33. package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java +200 -0
  34. package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java +457 -0
  35. package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java +96 -0
  36. package/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java +225 -0
  37. package/android/common/src/androidTest/java/com/marianhello/bgloc/TestPluginDelegate.java +46 -0
  38. package/android/common/src/androidTest/java/com/marianhello/bgloc/TestResourceResolver.java +14 -0
  39. package/android/common/src/androidTest/java/com/marianhello/bgloc/provider/MockLocationProvider.java +50 -0
  40. package/android/common/src/androidTest/java/com/marianhello/bgloc/provider/TestLocationProviderFactory.java +17 -0
  41. package/android/common/src/androidTest/java/com/marianhello/bgloc/sqlite/SQLiteOpenHelper10.java +92 -0
  42. package/android/common/src/androidTest/java/com/marianhello/bgloc/test/LocationProviderTestCase.java +107 -0
  43. package/android/common/src/androidTest/java/com/marianhello/bgloc/test/TestConstants.java +5 -0
  44. package/android/common/src/main/AndroidManifest.xml +72 -0
  45. package/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java +523 -0
  46. package/android/common/src/main/java/com/marianhello/bgloc/BootCompletedReceiver.java +59 -0
  47. package/android/common/src/main/java/com/marianhello/bgloc/Config.java +652 -0
  48. package/android/common/src/main/java/com/marianhello/bgloc/ConnectivityListener.java +5 -0
  49. package/android/common/src/main/java/com/marianhello/bgloc/HttpPostService.java +224 -0
  50. package/android/common/src/main/java/com/marianhello/bgloc/LocationManager.java +138 -0
  51. package/android/common/src/main/java/com/marianhello/bgloc/PluginDelegate.java +19 -0
  52. package/android/common/src/main/java/com/marianhello/bgloc/PluginException.java +38 -0
  53. package/android/common/src/main/java/com/marianhello/bgloc/PostLocationTask.java +188 -0
  54. package/android/common/src/main/java/com/marianhello/bgloc/ResourceResolver.java +55 -0
  55. package/android/common/src/main/java/com/marianhello/bgloc/data/AbstractLocationTemplate.java +69 -0
  56. package/android/common/src/main/java/com/marianhello/bgloc/data/ArrayListLocationTemplate.java +88 -0
  57. package/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundActivity.java +108 -0
  58. package/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java +994 -0
  59. package/android/common/src/main/java/com/marianhello/bgloc/data/ConfigurationDAO.java +13 -0
  60. package/android/common/src/main/java/com/marianhello/bgloc/data/DAOFactory.java +17 -0
  61. package/android/common/src/main/java/com/marianhello/bgloc/data/HashMapLocationTemplate.java +82 -0
  62. package/android/common/src/main/java/com/marianhello/bgloc/data/LocationDAO.java +22 -0
  63. package/android/common/src/main/java/com/marianhello/bgloc/data/LocationTemplate.java +12 -0
  64. package/android/common/src/main/java/com/marianhello/bgloc/data/LocationTemplateFactory.java +65 -0
  65. package/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java +19 -0
  66. package/android/common/src/main/java/com/marianhello/bgloc/data/provider/ContentProviderLocationDAO.java +395 -0
  67. package/android/common/src/main/java/com/marianhello/bgloc/data/provider/LocationContentProvider.java +321 -0
  68. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationContract.java +76 -0
  69. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationDAO.java +160 -0
  70. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationContract.java +112 -0
  71. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationDAO.java +506 -0
  72. package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteOpenHelper.java +151 -0
  73. package/android/common/src/main/java/com/marianhello/bgloc/headless/AbstractTaskRunner.java +15 -0
  74. package/android/common/src/main/java/com/marianhello/bgloc/headless/ActivityTask.java +48 -0
  75. package/android/common/src/main/java/com/marianhello/bgloc/headless/JsCallback.java +10 -0
  76. package/android/common/src/main/java/com/marianhello/bgloc/headless/LocationTask.java +60 -0
  77. package/android/common/src/main/java/com/marianhello/bgloc/headless/StationaryTask.java +25 -0
  78. package/android/common/src/main/java/com/marianhello/bgloc/headless/Task.java +8 -0
  79. package/android/common/src/main/java/com/marianhello/bgloc/headless/TaskRunner.java +5 -0
  80. package/android/common/src/main/java/com/marianhello/bgloc/headless/TaskRunnerFactory.java +8 -0
  81. package/android/common/src/main/java/com/marianhello/bgloc/provider/AbstractLocationProvider.java +171 -0
  82. package/android/common/src/main/java/com/marianhello/bgloc/provider/ActivityRecognitionLocationProvider.java +282 -0
  83. package/android/common/src/main/java/com/marianhello/bgloc/provider/DistanceFilterLocationProvider.java +610 -0
  84. package/android/common/src/main/java/com/marianhello/bgloc/provider/LocationProvider.java +32 -0
  85. package/android/common/src/main/java/com/marianhello/bgloc/provider/LocationProviderFactory.java +47 -0
  86. package/android/common/src/main/java/com/marianhello/bgloc/provider/ProviderDelegate.java +12 -0
  87. package/android/common/src/main/java/com/marianhello/bgloc/provider/RawLocationProvider.java +145 -0
  88. package/android/common/src/main/java/com/marianhello/bgloc/service/LocationService.java +16 -0
  89. package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java +749 -0
  90. package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceInfo.java +6 -0
  91. package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceInfoImpl.java +41 -0
  92. package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java +203 -0
  93. package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceProxy.java +130 -0
  94. package/android/common/src/main/java/com/marianhello/bgloc/sync/AccountHelper.java +39 -0
  95. package/android/common/src/main/java/com/marianhello/bgloc/sync/Authenticator.java +68 -0
  96. package/android/common/src/main/java/com/marianhello/bgloc/sync/AuthenticatorService.java +28 -0
  97. package/android/common/src/main/java/com/marianhello/bgloc/sync/BatchManager.java +278 -0
  98. package/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java +148 -0
  99. package/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java +249 -0
  100. package/android/common/src/main/java/com/marianhello/bgloc/sync/SyncService.java +68 -0
  101. package/android/common/src/main/java/com/marianhello/logging/DBLogReader.java +203 -0
  102. package/android/common/src/main/java/com/marianhello/logging/LogEntry.java +99 -0
  103. package/android/common/src/main/java/com/marianhello/logging/LoggerManager.java +70 -0
  104. package/android/common/src/main/java/com/marianhello/logging/UncaughtExceptionLogger.java +36 -0
  105. package/android/common/src/main/java/com/marianhello/utils/CloneHelper.java +22 -0
  106. package/android/common/src/main/java/com/marianhello/utils/Convert.java +56 -0
  107. package/android/common/src/main/java/com/marianhello/utils/TextUtils.java +72 -0
  108. package/android/common/src/main/java/com/marianhello/utils/ToneGenerator.java +68 -0
  109. package/android/common/src/main/java/org/apache/commons/io/Charsets.java +153 -0
  110. package/android/common/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java +344 -0
  111. package/android/common/src/main/java/org/chromium/content/browser/ThreadUtils.java +134 -0
  112. package/android/common/src/main/java/ru/andremoniy/sqlbuilder/SqlExpression.java +398 -0
  113. package/android/common/src/main/java/ru/andremoniy/sqlbuilder/SqlSelectStatement.java +671 -0
  114. package/android/common/src/main/java/ru/andremoniy/sqlbuilder/SqlStatement.java +29 -0
  115. package/android/common/src/main/java/ru/andremoniy/utils/TextUtils.java +61 -0
  116. package/android/common/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  117. package/android/common/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  118. package/android/common/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  119. package/android/common/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  120. package/android/common/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  121. package/android/common/src/main/res/values/strings.xml +4 -0
  122. package/android/common/src/main/res/xml/authenticator.xml +7 -0
  123. package/android/common/src/main/res/xml/syncadapter.xml +9 -0
  124. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/ArrayListLocationTemplateTest.java +82 -0
  125. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java +128 -0
  126. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java +191 -0
  127. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java +37 -0
  128. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/HashMapLocationTemplateTest.java +216 -0
  129. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/HttpPostServiceTest.java +223 -0
  130. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/LocationTemplateFactoryTest.java +50 -0
  131. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/PostLocationTaskTest.java +180 -0
  132. package/android/common/src/test/java/com/marianhello/backgroundgeolocation/TestHelper.java +16 -0
  133. package/android/dependencies.gradle +13 -0
  134. package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.h +41 -0
  135. package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.m +526 -0
  136. package/ios/common/BackgroundGeolocation/CocoaLumberjack.h +1945 -0
  137. package/ios/common/BackgroundGeolocation/CocoaLumberjack.m +5255 -0
  138. package/ios/common/BackgroundGeolocation/FMDB.h +2357 -0
  139. package/ios/common/BackgroundGeolocation/FMDB.m +2672 -0
  140. package/ios/common/BackgroundGeolocation/FMDBLogger.h +42 -0
  141. package/ios/common/BackgroundGeolocation/FMDBLogger.m +264 -0
  142. package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.h +41 -0
  143. package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.m +68 -0
  144. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager+Internal.h +33 -0
  145. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.h +178 -0
  146. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.m +1025 -0
  147. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.h +103 -0
  148. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.m +238 -0
  149. package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequestDefines.h +163 -0
  150. package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.h +39 -0
  151. package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.m +37 -0
  152. package/ios/common/BackgroundGeolocation/MAURAbstractLocationProvider.h +51 -0
  153. package/ios/common/BackgroundGeolocation/MAURAbstractLocationProvider.m +53 -0
  154. package/ios/common/BackgroundGeolocation/MAURActivity.h +23 -0
  155. package/ios/common/BackgroundGeolocation/MAURActivity.m +52 -0
  156. package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.h +18 -0
  157. package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.m +202 -0
  158. package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.h +60 -0
  159. package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.m +638 -0
  160. package/ios/common/BackgroundGeolocation/MAURBackgroundSync.h +34 -0
  161. package/ios/common/BackgroundGeolocation/MAURBackgroundSync.m +185 -0
  162. package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.h +25 -0
  163. package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.m +105 -0
  164. package/ios/common/BackgroundGeolocation/MAURConfig.h +74 -0
  165. package/ios/common/BackgroundGeolocation/MAURConfig.m +485 -0
  166. package/ios/common/BackgroundGeolocation/MAURConfigurationContract.h +49 -0
  167. package/ios/common/BackgroundGeolocation/MAURConfigurationContract.m +51 -0
  168. package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.h +20 -0
  169. package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.m +514 -0
  170. package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.h +17 -0
  171. package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.m +97 -0
  172. package/ios/common/BackgroundGeolocation/MAURLocation.h +59 -0
  173. package/ios/common/BackgroundGeolocation/MAURLocation.m +349 -0
  174. package/ios/common/BackgroundGeolocation/MAURLocationContract.h +34 -0
  175. package/ios/common/BackgroundGeolocation/MAURLocationContract.m +35 -0
  176. package/ios/common/BackgroundGeolocation/MAURLocationManager.h +53 -0
  177. package/ios/common/BackgroundGeolocation/MAURLocationManager.m +287 -0
  178. package/ios/common/BackgroundGeolocation/MAURLogReader.h +26 -0
  179. package/ios/common/BackgroundGeolocation/MAURLogReader.m +122 -0
  180. package/ios/common/BackgroundGeolocation/MAURLogging.h +19 -0
  181. package/ios/common/BackgroundGeolocation/MAURPostLocationTask.h +40 -0
  182. package/ios/common/BackgroundGeolocation/MAURPostLocationTask.m +250 -0
  183. package/ios/common/BackgroundGeolocation/MAURProviderDelegate.h +52 -0
  184. package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.h +18 -0
  185. package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.m +129 -0
  186. package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.h +26 -0
  187. package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.m +278 -0
  188. package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.h +57 -0
  189. package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.m +93 -0
  190. package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.h +38 -0
  191. package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.m +380 -0
  192. package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.h +32 -0
  193. package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.m +276 -0
  194. package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.h +20 -0
  195. package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.m +62 -0
  196. package/ios/common/BackgroundGeolocation/Reachability.h +102 -0
  197. package/ios/common/BackgroundGeolocation/Reachability.m +475 -0
  198. package/ios/common/BackgroundGeolocation/SOMotionDetector/CHANGELOG.md +2 -0
  199. package/ios/common/BackgroundGeolocation/SOMotionDetector/LICENSE +21 -0
  200. package/ios/common/BackgroundGeolocation/SOMotionDetector/README.md +135 -0
  201. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOLocationManager.h +80 -0
  202. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOLocationManager.m +147 -0
  203. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionActivity.h +30 -0
  204. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionActivity.m +42 -0
  205. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionDetector.h +99 -0
  206. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOMotionDetector.m +327 -0
  207. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOStepDetector.h +44 -0
  208. package/ios/common/BackgroundGeolocation/SOMotionDetector/SOStepDetector.m +94 -0
  209. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/README.md +170 -0
  210. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.h +55 -0
  211. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.m +47 -0
  212. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlDataManipulationCommand.h +27 -0
  213. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.h +250 -0
  214. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.m +259 -0
  215. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.h +360 -0
  216. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.m +427 -0
  217. package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlStatement.h +37 -0
  218. package/ios/common/BackgroundGeolocation.xcodeproj/project.pbxproj +760 -0
  219. package/ios/common/BackgroundGeolocationTests/Info.plist +24 -0
  220. package/ios/common/BackgroundGeolocationTests/MAURBackgroundLocationTest.m +185 -0
  221. package/ios/common/BackgroundGeolocationTests/MAURConfigTest.m +161 -0
  222. package/ios/common/BackgroundGeolocationTests/MAURGeolocationOpenHelperTest.m +102 -0
  223. package/ios/common/BackgroundGeolocationTests/MAURLocationTest.m +216 -0
  224. package/ios/common/BackgroundGeolocationTests/MAURLocationUploaderTest.m +55 -0
  225. package/ios/common/BackgroundGeolocationTests/MAURLogReaderTest.m +43 -0
  226. package/ios/common/BackgroundGeolocationTests/MAURSQLiteConfigurationDAOTest.m +102 -0
  227. package/ios/common/BackgroundGeolocationTests/MAURSQLiteHelperTest.m +41 -0
  228. package/ios/common/BackgroundGeolocationTests/MAURSQLiteLocationDAOTests.m +240 -0
  229. package/ios/common/BackgroundGeolocationTests/MAURSQLiteLocationDAOThreadTest.m +84 -0
  230. package/ios/common/BackgroundGeolocationTests/MAURSQLiteOpenHelperTest.m +144 -0
  231. package/ios/common/CONTRIBUTORS.md +10 -0
  232. package/ios/common/LICENSE +191 -0
  233. package/ios/common/README.md +7 -0
  234. package/ios/common/scripts/xcode-refactor.js +184 -0
  235. package/package.json +44 -0
  236. package/plugin.xml +355 -0
  237. package/www/BackgroundGeolocation.d.ts +910 -0
  238. package/www/BackgroundGeolocation.js +247 -0
  239. package/www/radio.js +177 -0
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Copyright (C) 2006 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package ru.andremoniy.utils;
18
+
19
+
20
+ import java.util.Iterator;
21
+
22
+ public class TextUtils {
23
+ private static final String TAG = "TextUtils";
24
+
25
+ /**
26
+ * Returns a string containing the tokens joined by delimiters.
27
+ * @param tokens an array objects to be joined. Strings will be formed from
28
+ * the objects by calling object.toString().
29
+ */
30
+ public static String join(CharSequence delimiter, Object[] tokens) {
31
+ StringBuilder sb = new StringBuilder();
32
+ boolean firstTime = true;
33
+ for (Object token: tokens) {
34
+ if (firstTime) {
35
+ firstTime = false;
36
+ } else {
37
+ sb.append(delimiter);
38
+ }
39
+ sb.append(token);
40
+ }
41
+ return sb.toString();
42
+ }
43
+
44
+ /**
45
+ * Returns a string containing the tokens joined by delimiters.
46
+ * @param tokens an array objects to be joined. Strings will be formed from
47
+ * the objects by calling object.toString().
48
+ */
49
+ public static String join(CharSequence delimiter, Iterable tokens) {
50
+ StringBuilder sb = new StringBuilder();
51
+ Iterator<?> it = tokens.iterator();
52
+ if (it.hasNext()) {
53
+ sb.append(it.next());
54
+ while (it.hasNext()) {
55
+ sb.append(delimiter);
56
+ sb.append(it.next());
57
+ }
58
+ }
59
+ return sb.toString();
60
+ }
61
+ }
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <string name="app_name">app_name</string>
4
+ </resources>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <account-authenticator
3
+ xmlns:android="http://schemas.android.com/apk/res/android"
4
+ android:accountType="@string/plugin_bgloc_account_type"
5
+ android:icon="@mipmap/ic_launcher"
6
+ android:smallIcon="@mipmap/ic_launcher"
7
+ android:label="@string/app_name"/>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <sync-adapter
3
+ xmlns:android="http://schemas.android.com/apk/res/android"
4
+ android:contentAuthority="@string/plugin_bgloc_content_authority"
5
+ android:accountType="@string/plugin_bgloc_account_type"
6
+ android:userVisible="false"
7
+ android:supportsUploading="true"
8
+ android:allowParallelSyncs="false"
9
+ android:isAlwaysSyncable="true"/>
@@ -0,0 +1,82 @@
1
+ package com.marianhello.backgroundgeolocation;
2
+
3
+ import com.marianhello.bgloc.data.ArrayListLocationTemplate;
4
+ import com.marianhello.bgloc.data.BackgroundLocation;
5
+ import com.marianhello.bgloc.data.LocationTemplate;
6
+
7
+ import junit.framework.Assert;
8
+
9
+ import org.json.JSONArray;
10
+ import org.json.JSONException;
11
+ import org.junit.Test;
12
+
13
+ import java.util.ArrayList;
14
+
15
+ /**
16
+ * Created by finch on 15.12.2017.
17
+ */
18
+
19
+ public class ArrayListLocationTemplateTest {
20
+ @Test
21
+ public void testArrayTemplateToString() {
22
+ ArrayList props = new ArrayList();
23
+ props.add("foo");
24
+ props.add("bar");
25
+ props.add(123);
26
+ props.add("foo");
27
+ ArrayListLocationTemplate tpl = new ArrayListLocationTemplate(props);
28
+
29
+ Assert.assertEquals("[\"foo\",\"bar\",123,\"foo\"]" , tpl.toString());
30
+ }
31
+
32
+ @Test
33
+ public void testLocationToJSONArray() throws JSONException {
34
+ BackgroundLocation location = new BackgroundLocation();
35
+ location.setLocationId(11L);
36
+ location.setProvider("test");
37
+ location.setElapsedRealtimeNanos(2000000000L * 60 * 2);
38
+ location.setAltitude(100);
39
+ location.setLatitude(49);
40
+ location.setLongitude(5);
41
+ location.setLocationProvider(1);
42
+ location.setAccuracy(105);
43
+ location.setSpeed(50);
44
+ location.setBearing(1);
45
+
46
+ ArrayList props = new ArrayList();
47
+ props.add("@id");
48
+ props.add("@provider");
49
+ props.add("@time");
50
+ props.add("@altitude");
51
+ props.add("@latitude");
52
+ props.add("@longitude");
53
+ props.add("foo");
54
+ props.add("@locationProvider");
55
+ props.add("@accuracy");
56
+ props.add("@speed");
57
+ props.add("@bearing");
58
+ props.add(123);
59
+
60
+ LocationTemplate tpl = new ArrayListLocationTemplate(props);
61
+ JSONArray expected = (JSONArray) tpl.locationToJson(location);
62
+
63
+ Assert.assertEquals(expected.get(0), location.getLocationId());
64
+ Assert.assertEquals(expected.get(1), location.getProvider());
65
+ Assert.assertEquals(expected.get(2), location.getTime());
66
+ Assert.assertEquals(expected.get(3), location.getAltitude());
67
+ Assert.assertEquals(expected.get(4), location.getLatitude());
68
+ Assert.assertEquals(expected.get(5), location.getLongitude());
69
+ Assert.assertEquals(expected.get(6), "foo");
70
+ Assert.assertEquals(expected.get(7), location.getLocationProvider());
71
+ Assert.assertEquals(expected.get(8), location.getAccuracy());
72
+ Assert.assertEquals(expected.get(9), location.getSpeed());
73
+ Assert.assertEquals(expected.get(10), location.getBearing());
74
+ Assert.assertEquals(expected.get(11), 123);
75
+ }
76
+
77
+ @Test
78
+ public void testNullToString() {
79
+ ArrayListLocationTemplate tpl = new ArrayListLocationTemplate((ArrayList)null);
80
+ Assert.assertEquals("null", tpl.toString());
81
+ }
82
+ }
@@ -0,0 +1,128 @@
1
+ package com.marianhello.backgroundgeolocation;
2
+
3
+ import android.os.Build;
4
+ import androidx.test.filters.SmallTest;
5
+
6
+ import com.marianhello.bgloc.data.BackgroundLocation;
7
+
8
+ import junit.framework.Assert;
9
+
10
+ import org.junit.Test;
11
+
12
+ import java.lang.reflect.Field;
13
+ import java.lang.reflect.Modifier;
14
+
15
+ /**
16
+ * Created by finch on 10/08/16.
17
+ */
18
+ @SmallTest
19
+ public class BackgroundLocationTest {
20
+
21
+ static void setSDKVersion(Object newValue) {
22
+
23
+ Field modifiersField = null;
24
+ try {
25
+ Field field = Build.VERSION.class.getField("SDK_INT");
26
+
27
+ field.setAccessible(true);
28
+
29
+ modifiersField = Field.class.getDeclaredField("modifiers");
30
+ modifiersField.setAccessible(true);
31
+ modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
32
+
33
+ field.set(null, newValue);
34
+ } catch (Exception e) {
35
+ e.printStackTrace();
36
+ }
37
+ }
38
+
39
+ @Test public void testHasMockShouldBeFalse() {
40
+ BackgroundLocation l = new BackgroundLocation();
41
+ Assert.assertFalse(l.hasIsFromMockProvider());
42
+ Assert.assertFalse(l.hasMockLocationsEnabled());
43
+ Assert.assertEquals(0x0, l.getMockFlags());
44
+ }
45
+
46
+ @Test public void testHasMockShouldBeTrue() {
47
+ BackgroundLocation l = new BackgroundLocation();
48
+ l.setMockLocationsEnabled(true);
49
+ l.setIsFromMockProvider(true);
50
+ Assert.assertTrue(l.hasMockLocationsEnabled());
51
+ Assert.assertTrue(l.areMockLocationsEnabled());
52
+ Assert.assertEquals(0xF, l.getMockFlags());
53
+ }
54
+
55
+ @Test public void testIsFromMockProviderShouldBeTrue() {
56
+ BackgroundLocation l = new BackgroundLocation();
57
+ l.setIsFromMockProvider(true);
58
+ Assert.assertTrue(l.hasIsFromMockProvider());
59
+ Assert.assertTrue(l.isFromMockProvider());
60
+ Assert.assertEquals(0x3, l.getMockFlags());
61
+ }
62
+
63
+ @Test public void testIsFromMockProviderShouldBeFalse() {
64
+ BackgroundLocation l = new BackgroundLocation();
65
+ l.setIsFromMockProvider(false);
66
+ Assert.assertTrue(l.hasIsFromMockProvider());
67
+ Assert.assertFalse(l.isFromMockProvider());
68
+ Assert.assertEquals(0x2, l.getMockFlags());
69
+ }
70
+
71
+ @Test public void testAreMockLocationsEnabledShouldBeTrue() {
72
+ BackgroundLocation l = new BackgroundLocation();
73
+ l.setMockLocationsEnabled(true);
74
+ Assert.assertTrue(l.hasMockLocationsEnabled());
75
+ Assert.assertTrue(l.areMockLocationsEnabled());
76
+ Assert.assertEquals(0xC, l.getMockFlags());
77
+ }
78
+
79
+ @Test public void testAreMockLocationsEnabledShouldBeFalse() {
80
+ BackgroundLocation l = new BackgroundLocation();
81
+ l.setMockLocationsEnabled(false);
82
+ Assert.assertTrue(l.hasMockLocationsEnabled());
83
+ Assert.assertFalse(l.areMockLocationsEnabled());
84
+ Assert.assertEquals(0x8, l.getMockFlags());
85
+ }
86
+
87
+ @Test
88
+ public void olderLocationShouldBeWorse() {
89
+ setSDKVersion(17);
90
+
91
+ BackgroundLocation netLocation = new BackgroundLocation();
92
+ netLocation.setProvider("network");
93
+ netLocation.setLatitude(49);
94
+ netLocation.setLongitude(5);
95
+ netLocation.setAccuracy(38);
96
+ netLocation.setElapsedRealtimeNanos(1470776557324L * 1000000L);
97
+
98
+ BackgroundLocation gpsLocation = new BackgroundLocation();
99
+ gpsLocation.setProvider("gps");
100
+ gpsLocation.setLatitude(49);
101
+ gpsLocation.setLongitude(5);
102
+ gpsLocation.setAccuracy(5);
103
+ gpsLocation.setElapsedRealtimeNanos(1470773246000L * 1000000L);
104
+
105
+ Assert.assertFalse(gpsLocation.isBetterLocationThan(netLocation));
106
+ }
107
+
108
+ @Test
109
+ public void newerLocationShouldBeBetter() {
110
+ setSDKVersion(17);
111
+
112
+ BackgroundLocation netLocation = new BackgroundLocation();
113
+ netLocation.setProvider("network");
114
+ netLocation.setLatitude(49);
115
+ netLocation.setLongitude(5);
116
+ netLocation.setAccuracy(38);
117
+ netLocation.setElapsedRealtimeNanos(0);
118
+
119
+ BackgroundLocation gpsLocation = new BackgroundLocation();
120
+ gpsLocation.setProvider("gps");
121
+ gpsLocation.setLatitude(49);
122
+ gpsLocation.setLongitude(5);
123
+ gpsLocation.setAccuracy(105);
124
+ gpsLocation.setElapsedRealtimeNanos(2000000000L * 60 * 2);
125
+
126
+ Assert.assertFalse(netLocation.isBetterLocationThan(gpsLocation));
127
+ }
128
+ }
@@ -0,0 +1,191 @@
1
+ package com.marianhello.backgroundgeolocation;
2
+
3
+ import androidx.test.filters.SmallTest;
4
+
5
+ import com.marianhello.bgloc.Config;
6
+ import com.marianhello.bgloc.data.ArrayListLocationTemplate;
7
+ import com.marianhello.bgloc.data.HashMapLocationTemplate;
8
+ import com.marianhello.bgloc.data.LocationTemplate;
9
+ import com.marianhello.bgloc.data.LocationTemplateFactory;
10
+
11
+ import junit.framework.Assert;
12
+
13
+ import org.junit.Test;
14
+
15
+ import java.util.ArrayList;
16
+ import java.util.HashMap;
17
+
18
+ /**
19
+ * Created by finch on 29.11.2017.
20
+ */
21
+
22
+ @SmallTest
23
+ public class ConfigTest {
24
+ @Test
25
+ public void testEmptyConfig() {
26
+ Config config = new Config();
27
+
28
+ Assert.assertFalse(config.hasStationaryRadius());
29
+ Assert.assertFalse(config.hasDistanceFilter());
30
+ Assert.assertFalse(config.hasDesiredAccuracy());
31
+ Assert.assertFalse(config.hasDebug());
32
+ Assert.assertFalse(config.hasNotificationTitle());
33
+ Assert.assertFalse(config.hasNotificationText());
34
+ Assert.assertFalse(config.hasStopOnTerminate());
35
+ Assert.assertFalse(config.hasStartOnBoot());
36
+ Assert.assertFalse(config.hasLocationProvider());
37
+ Assert.assertFalse(config.hasInterval());
38
+ Assert.assertFalse(config.hasFastestInterval());
39
+ Assert.assertFalse(config.hasActivitiesInterval());
40
+ Assert.assertFalse(config.hasNotificationIconColor());
41
+ Assert.assertFalse(config.hasLargeNotificationIcon());
42
+ Assert.assertFalse(config.hasSmallNotificationIcon());
43
+ Assert.assertFalse(config.hasStartForeground());
44
+ Assert.assertFalse(config.hasStopOnStillActivity());
45
+ Assert.assertFalse(config.hasUrl());
46
+ Assert.assertFalse(config.hasSyncUrl());
47
+ Assert.assertFalse(config.hasSyncThreshold());
48
+ Assert.assertFalse(config.hasHttpHeaders());
49
+ Assert.assertFalse(config.hasMaxLocations());
50
+ Assert.assertFalse(config.hasTemplate());
51
+ }
52
+
53
+ @Test
54
+ public void testDefaultConfig() {
55
+ Config config = Config.getDefault();
56
+
57
+ Assert.assertEquals(config.getStationaryRadius(), 50f);
58
+ Assert.assertEquals(config.getDistanceFilter().intValue(), 500);
59
+ Assert.assertEquals(config.getDesiredAccuracy().intValue(), 100);
60
+ Assert.assertFalse(config.isDebugging());
61
+ Assert.assertEquals(config.getNotificationTitle(), "Background tracking");
62
+ Assert.assertEquals(config.getNotificationText(), "ENABLED");
63
+ Assert.assertTrue(config.getStopOnTerminate());
64
+ Assert.assertFalse(config.getStartOnBoot());
65
+ Assert.assertEquals(config.getLocationProvider().intValue(), 0);
66
+ Assert.assertEquals(config.getInterval().intValue(), 600000);
67
+ Assert.assertEquals(config.getFastestInterval().intValue(), 120000);
68
+ Assert.assertEquals(config.getActivitiesInterval().intValue(), 10000);
69
+ Assert.assertEquals(config.getNotificationIconColor(), "");
70
+ Assert.assertEquals(config.getLargeNotificationIcon(), "");
71
+ Assert.assertEquals(config.getSmallNotificationIcon(), "");
72
+ Assert.assertTrue(config.getStartForeground());
73
+ Assert.assertTrue(config.getStopOnStillActivity());
74
+ Assert.assertEquals(config.getUrl(), "");
75
+ Assert.assertEquals(config.getSyncUrl(), "");
76
+ Assert.assertEquals(config.getSyncThreshold().intValue(), 100);
77
+ Assert.assertTrue(config.getHttpHeaders().isEmpty());
78
+ Assert.assertEquals(config.getTemplate(), LocationTemplateFactory.getDefault());
79
+ Assert.assertEquals(config.getMaxLocations().intValue(), 10000);
80
+ }
81
+
82
+ @Test
83
+ public void testMergeConfig() {
84
+ Config config = new Config();
85
+
86
+ config.setSyncThreshold(10);
87
+ config.setMaxLocations(1000);
88
+ config.setDesiredAccuracy(5);
89
+
90
+ Config newConfig = new Config();
91
+ newConfig.setSyncThreshold(100);
92
+ newConfig.setDesiredAccuracy(500);
93
+
94
+ Config merged = Config.merge(config, newConfig);
95
+
96
+ Assert.assertEquals(merged.getSyncThreshold().intValue(), 100);
97
+ Assert.assertEquals(merged.getMaxLocations().intValue(), 1000);
98
+ Assert.assertEquals(merged.getDesiredAccuracy().intValue(), 500);
99
+
100
+ Assert.assertEquals(config.getSyncThreshold().intValue(), 10);
101
+ Assert.assertEquals(config.getMaxLocations().intValue(), 1000);
102
+ Assert.assertEquals(config.getDesiredAccuracy().intValue(), 5);
103
+
104
+ Assert.assertNotSame(config, merged);
105
+ Assert.assertNotSame(config.getSyncThreshold(), merged.getSyncThreshold());
106
+ Assert.assertNotSame(config.getDesiredAccuracy(), merged.getDesiredAccuracy());
107
+ }
108
+
109
+ @Test
110
+ public void testMergeHttpHeaders() {
111
+ HashMap httpHeaders = new HashMap<String, String>();
112
+ httpHeaders.put("key", "value");
113
+
114
+ Config config = new Config();
115
+ config.setHttpHeaders(httpHeaders);
116
+
117
+ Config merged = Config.merge(config, new Config());
118
+ httpHeaders.put("key", "othervalue");
119
+
120
+ Assert.assertNotSame(config, merged);
121
+ Assert.assertNotSame(config.getHttpHeaders(), merged.getHttpHeaders());
122
+ Assert.assertEquals("value", merged.getHttpHeaders().get("key"));
123
+ Assert.assertEquals("othervalue", config.getHttpHeaders().get("key"));
124
+ }
125
+
126
+ @Test
127
+ public void testMergeHashTemplate() {
128
+ HashMap map = new HashMap();
129
+ map.put("key", "value");
130
+ LocationTemplate tpl = new HashMapLocationTemplate(map);
131
+
132
+ Config config = new Config();
133
+ config.setTemplate(tpl);
134
+
135
+ Config merged = Config.merge(config, new Config());
136
+ map.put("key", "othervalue");
137
+
138
+ Assert.assertNotSame(config, merged);
139
+ Assert.assertNotSame(config.getTemplate(), merged.getTemplate());
140
+ Assert.assertEquals("value", ((HashMapLocationTemplate)merged.getTemplate()).get("key"));
141
+ Assert.assertEquals("othervalue", ((HashMapLocationTemplate)config.getTemplate()).get("key"));
142
+ }
143
+
144
+
145
+ @Test
146
+ public void testMergeArrayTemplate() {
147
+ ArrayList props = new ArrayList();
148
+ props.add("foo");
149
+ ArrayListLocationTemplate tpl = new ArrayListLocationTemplate(props);
150
+
151
+ Config config = new Config();
152
+ config.setTemplate(tpl);
153
+
154
+ Config merged = Config.merge(config, new Config());
155
+
156
+ props.add(0, "foobar");
157
+
158
+ Assert.assertNotSame(config, merged);
159
+ Assert.assertNotSame(config.getTemplate(), merged.getTemplate());
160
+ Assert.assertEquals("foo", ((ArrayListLocationTemplate)merged.getTemplate()).toArray()[0]);
161
+ Assert.assertEquals("foobar", ((ArrayListLocationTemplate)config.getTemplate()).toArray()[0]);
162
+ }
163
+
164
+ @Test
165
+ public void testMergeEmptyUrls() {
166
+ Config config1 = new Config();
167
+ config1.setUrl("url");
168
+ config1.setSyncUrl("syncUrl");
169
+
170
+ Config config2 = new Config();
171
+ config2.setUrl("");
172
+ config2.setSyncUrl("");
173
+
174
+ Assert.assertEquals("", Config.merge(config1, config2).getUrl());
175
+ Assert.assertEquals("", Config.merge(config1, config2).getSyncUrl());
176
+ }
177
+
178
+ @Test
179
+ public void testResetToDefaultProps() {
180
+ Config config1 = new Config();
181
+ config1.setUrl("url");
182
+ config1.setSyncUrl("syncUrl");
183
+
184
+ Config config2 = new Config();
185
+ config2.setUrl("");
186
+ config2.setSyncUrl("");
187
+
188
+ Assert.assertEquals(Config.getDefault().getUrl(), Config.merge(config1, config2).getUrl());
189
+ Assert.assertEquals(Config.getDefault().getSyncUrl(), Config.merge(config1, config2).getSyncUrl());
190
+ }
191
+ }
@@ -0,0 +1,37 @@
1
+ package com.marianhello.backgroundgeolocation;
2
+
3
+ import androidx.test.filters.SmallTest;
4
+
5
+ import com.marianhello.logging.DBLogReader;
6
+
7
+ import junit.framework.Assert;
8
+
9
+ import org.junit.Test;
10
+ import org.slf4j.event.Level;
11
+
12
+ @SmallTest
13
+ public class DBLogReaderTest {
14
+ @Test
15
+ public void testBuildQuery() {
16
+ DBLogReader.QueryBuilder qb = new DBLogReader.QueryBuilder();
17
+ String sql = qb.buildQuery(100, 0, Level.DEBUG);
18
+
19
+ Assert.assertEquals("SELECT [event_id], [timestmp], [formatted_message], [logger_name], [level_string] FROM [logging_event] WHERE [level_string] IN ('ERROR', 'WARN', 'INFO', 'DEBUG') ORDER BY [timestmp] DESC, [event_id] DESC LIMIT 100;", sql);
20
+ }
21
+
22
+ @Test
23
+ public void testBuildQueryWithOffset() {
24
+ DBLogReader.QueryBuilder qb = new DBLogReader.QueryBuilder();
25
+ String sql = qb.buildQuery(100, 10, Level.ERROR);
26
+
27
+ Assert.assertEquals("SELECT [event_id], [timestmp], [formatted_message], [logger_name], [level_string] FROM [logging_event] WHERE [level_string] IN ('ERROR') AND [event_id] < 10 ORDER BY [timestmp] DESC, [event_id] DESC LIMIT 100;", sql);
28
+ }
29
+
30
+ @Test
31
+ public void testBuildStackTraceQuery() {
32
+ DBLogReader.QueryBuilder qb = new DBLogReader.QueryBuilder();
33
+ String sql = qb.buildStackTraceQuery(100);
34
+
35
+ Assert.assertEquals("SELECT [trace_line] FROM [logging_event_exception] WHERE [i] = 100 ORDER BY [i] ASC;", sql);
36
+ }
37
+ }