react-native-background-geolocation 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/.github/stale.yml +41 -0
  2. package/CHANGELOG.md +1131 -0
  3. package/LICENSE +22 -0
  4. package/README.md +292 -0
  5. package/RNBackgroundGeolocation.podspec +27 -0
  6. package/android/.idea/compiler.xml +22 -0
  7. package/android/.idea/copyright/profiles_settings.xml +3 -0
  8. package/android/.idea/encodings.xml +6 -0
  9. package/android/.idea/gradle.xml +12 -0
  10. package/android/.idea/misc.xml +4 -0
  11. package/android/.idea/modules.xml +8 -0
  12. package/android/.idea/runConfigurations.xml +12 -0
  13. package/android/RNBackgroundGeolocation.iml +119 -0
  14. package/android/android.iml +20 -0
  15. package/android/app.gradle +22 -0
  16. package/android/build.gradle +62 -0
  17. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.aar +0 -0
  18. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.aar.md5 +1 -0
  19. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.aar.sha1 +1 -0
  20. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.aar.sha256 +1 -0
  21. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.aar.sha512 +1 -0
  22. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.pom +9 -0
  23. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.pom.md5 +1 -0
  24. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.pom.sha1 +1 -0
  25. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.pom.sha256 +1 -0
  26. package/android/libs/com/transistorsoft/tslocationmanager/3.1.33/tslocationmanager-3.1.33.pom.sha512 +1 -0
  27. package/android/libs/com/transistorsoft/tslocationmanager/maven-metadata.xml +14 -0
  28. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.aar +0 -0
  29. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.aar.md5 +1 -0
  30. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.aar.sha1 +1 -0
  31. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.aar.sha256 +1 -0
  32. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.aar.sha512 +1 -0
  33. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.pom +9 -0
  34. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.pom.md5 +1 -0
  35. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.pom.sha1 +1 -0
  36. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.pom.sha256 +1 -0
  37. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.1.33/tslocationmanager-reverse-3.1.33.pom.sha512 +1 -0
  38. package/android/libs/com/transistorsoft/tslocationmanager-reverse/maven-metadata.xml +14 -0
  39. package/android/proguard-rules.pro +30 -0
  40. package/android/react-native-background-geolocation-android.iml +229 -0
  41. package/android/src/main/AndroidManifest.xml +6 -0
  42. package/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/HeadlessTask.java +171 -0
  43. package/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocation.java +33 -0
  44. package/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationModule.java +1261 -0
  45. package/android/src/main/res/values/strings.xml +3 -0
  46. package/ios/RNBackgroundGeolocation/RNBackgroundGeolocation.h +22 -0
  47. package/ios/RNBackgroundGeolocation/RNBackgroundGeolocation.m +754 -0
  48. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/Info.plist +57 -0
  49. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/AtomicBoolean.h +18 -0
  50. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/ConfigModule.h +21 -0
  51. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/HttpRequest.h +21 -0
  52. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/HttpResponse.h +29 -0
  53. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/LocationManager.h +55 -0
  54. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/LogQuery.h +13 -0
  55. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/SOMotionDetector.h +140 -0
  56. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/SQLQuery.h +34 -0
  57. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSActivityChangeEvent.h +16 -0
  58. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSAuthorization.h +37 -0
  59. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSAuthorizationEvent.h +17 -0
  60. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSCallback.h +18 -0
  61. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSConfig.h +304 -0
  62. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSConnectivityChangeEvent.h +17 -0
  63. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSCurrentPositionRequest.h +43 -0
  64. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSDeviceInfo.h +24 -0
  65. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSEnabledChangeEvent.h +15 -0
  66. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSGeofence.h +50 -0
  67. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSGeofenceEvent.h +60 -0
  68. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSGeofenceManager.h +50 -0
  69. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSGeofencesChangeEvent.h +17 -0
  70. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSHeartbeatEvent.h +18 -0
  71. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSHttpEvent.h +19 -0
  72. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSHttpService.h +58 -0
  73. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSLocation.h +101 -0
  74. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSLocationManager.h +312 -0
  75. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSPowerSaveChangeEvent.h +14 -0
  76. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSProviderChangeEvent.h +20 -0
  77. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSReachability.h +106 -0
  78. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSSchedule.h +40 -0
  79. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSScheduleEvent.h +18 -0
  80. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TSWatchPositionRequest.h +41 -0
  81. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Headers/TransistorAuthorizationToken.h +31 -0
  82. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Info.plist +0 -0
  83. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Modules/module.modulemap +6 -0
  84. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/TSLocationManager +0 -0
  85. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/AtomicBoolean.h +18 -0
  86. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/ConfigModule.h +21 -0
  87. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/HttpRequest.h +21 -0
  88. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/HttpResponse.h +29 -0
  89. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/LocationManager.h +55 -0
  90. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/LogQuery.h +13 -0
  91. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/SOMotionDetector.h +140 -0
  92. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/SQLQuery.h +34 -0
  93. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSActivityChangeEvent.h +16 -0
  94. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSAuthorization.h +37 -0
  95. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSAuthorizationEvent.h +17 -0
  96. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSCallback.h +18 -0
  97. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSConfig.h +304 -0
  98. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSConnectivityChangeEvent.h +17 -0
  99. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSCurrentPositionRequest.h +43 -0
  100. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSDeviceInfo.h +24 -0
  101. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSEnabledChangeEvent.h +15 -0
  102. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofence.h +50 -0
  103. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofenceEvent.h +60 -0
  104. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofenceManager.h +50 -0
  105. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofencesChangeEvent.h +17 -0
  106. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSHeartbeatEvent.h +18 -0
  107. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSHttpEvent.h +19 -0
  108. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSHttpService.h +58 -0
  109. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSLocation.h +101 -0
  110. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSLocationManager.h +312 -0
  111. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSPowerSaveChangeEvent.h +14 -0
  112. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSProviderChangeEvent.h +20 -0
  113. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSReachability.h +106 -0
  114. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSSchedule.h +40 -0
  115. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSScheduleEvent.h +18 -0
  116. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TSWatchPositionRequest.h +41 -0
  117. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Headers/TransistorAuthorizationToken.h +31 -0
  118. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Info.plist +0 -0
  119. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Modules/module.modulemap +6 -0
  120. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/TSLocationManager +0 -0
  121. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeDirectory +0 -0
  122. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeRequirements +0 -0
  123. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeRequirements-1 +0 -0
  124. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeResources +612 -0
  125. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeSignature +0 -0
  126. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/AtomicBoolean.h +18 -0
  127. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/ConfigModule.h +21 -0
  128. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/HttpRequest.h +21 -0
  129. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/HttpResponse.h +29 -0
  130. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/LocationManager.h +55 -0
  131. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/LogQuery.h +13 -0
  132. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/SOMotionDetector.h +140 -0
  133. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/SQLQuery.h +34 -0
  134. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSActivityChangeEvent.h +16 -0
  135. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSAuthorization.h +37 -0
  136. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSAuthorizationEvent.h +17 -0
  137. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSCallback.h +18 -0
  138. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSConfig.h +304 -0
  139. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSConnectivityChangeEvent.h +17 -0
  140. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSCurrentPositionRequest.h +43 -0
  141. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSDeviceInfo.h +24 -0
  142. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSEnabledChangeEvent.h +15 -0
  143. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofence.h +50 -0
  144. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofenceEvent.h +60 -0
  145. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofenceManager.h +50 -0
  146. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofencesChangeEvent.h +17 -0
  147. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSHeartbeatEvent.h +18 -0
  148. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSHttpEvent.h +19 -0
  149. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSHttpService.h +58 -0
  150. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSLocation.h +101 -0
  151. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSLocationManager.h +312 -0
  152. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSPowerSaveChangeEvent.h +14 -0
  153. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSProviderChangeEvent.h +20 -0
  154. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSReachability.h +106 -0
  155. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSSchedule.h +40 -0
  156. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSScheduleEvent.h +18 -0
  157. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSWatchPositionRequest.h +41 -0
  158. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TransistorAuthorizationToken.h +31 -0
  159. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Modules/module.modulemap +6 -0
  160. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Resources/Info.plist +50 -0
  161. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/TSLocationManager +0 -0
  162. package/ios/RNBackgroundGeolocation.xcodeproj/project.pbxproj +341 -0
  163. package/ios/RNBackgroundGeolocation.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  164. package/ios/RNBackgroundGeolocation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  165. package/ios/RNBackgroundGeolocation.xcodeproj/project.xcworkspace/xcshareddata/RNBackgroundGeolocation.xccheckout +41 -0
  166. package/ios/RNBackgroundGeolocation.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  167. package/ios/RNBackgroundGeolocation.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/Build.xcscheme +80 -0
  168. package/ios/RNBackgroundGeolocation.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/RNBackgroundGeolocation.xcscheme +113 -0
  169. package/ios/RNBackgroundGeolocation.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist +37 -0
  170. package/ios/RNBackgroundGeolocationTests/Info.plist +24 -0
  171. package/package.json +54 -0
  172. package/react-native.config.js +20 -0
  173. package/scripts/cp-declarations +53 -0
  174. package/scripts/declare-module +3 -0
  175. package/scripts/docs-index.html +4 -0
  176. package/scripts/generate-docs +23 -0
  177. package/scripts/postlink.js +146 -0
  178. package/scripts/postunlink.js +128 -0
  179. package/scripts/tsconfig.json +21 -0
  180. package/scripts/xcode-helpers.js +171 -0
  181. package/src/DeviceSettings.js +52 -0
  182. package/src/Events.js +17 -0
  183. package/src/Logger.js +90 -0
  184. package/src/NativeModule.js +528 -0
  185. package/src/TransistorAuthorizationToken.js +73 -0
  186. package/src/declarations/BackgroundGeolocation.d.ts +1601 -0
  187. package/src/declarations/interfaces/Authorization.d.ts +156 -0
  188. package/src/declarations/interfaces/AuthorizationEvent.d.ts +30 -0
  189. package/src/declarations/interfaces/Config.d.ts +2437 -0
  190. package/src/declarations/interfaces/ConnectivityChangeEvent.d.ts +18 -0
  191. package/src/declarations/interfaces/CurrentPositionRequest.d.ts +45 -0
  192. package/src/declarations/interfaces/DeviceInfo.d.ts +33 -0
  193. package/src/declarations/interfaces/DeviceSettings.d.ts +223 -0
  194. package/src/declarations/interfaces/Geofence.d.ts +255 -0
  195. package/src/declarations/interfaces/GeofenceEvent.d.ts +30 -0
  196. package/src/declarations/interfaces/GeofencesChangeEvent.d.ts +22 -0
  197. package/src/declarations/interfaces/HeartbeatEvent.d.ts +20 -0
  198. package/src/declarations/interfaces/HttpEvent.d.ts +313 -0
  199. package/src/declarations/interfaces/Location.d.ts +216 -0
  200. package/src/declarations/interfaces/LocationAuthorizationAlert.d.ts +41 -0
  201. package/src/declarations/interfaces/Logger.d.ts +359 -0
  202. package/src/declarations/interfaces/MotionActivityEvent.d.ts +31 -0
  203. package/src/declarations/interfaces/MotionChangeEvent.d.ts +15 -0
  204. package/src/declarations/interfaces/Notification.d.ts +484 -0
  205. package/src/declarations/interfaces/PermissionRationale.d.ts +31 -0
  206. package/src/declarations/interfaces/ProviderChangeEvent.d.ts +74 -0
  207. package/src/declarations/interfaces/SQLQuery.d.ts +60 -0
  208. package/src/declarations/interfaces/Sensors.d.ts +31 -0
  209. package/src/declarations/interfaces/State.d.ts +51 -0
  210. package/src/declarations/interfaces/TransistorAuthorizationToken.d.ts +63 -0
  211. package/src/declarations/interfaces/WatchPositionRequest.d.ts +45 -0
  212. package/src/declarations/types.d.ts +170 -0
  213. package/src/index.d.ts +1 -0
  214. package/src/index.js +822 -0
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ import { NativeModules } from "react-native"
4
+
5
+ const DEFAULT_URL = 'http://tracker.transistorsoft.com';
6
+
7
+ const DUMMY_TOKEN = 'DUMMY_TOKEN';
8
+
9
+ const REFRESH_PAYLOAD = {
10
+ refresh_token: '{refreshToken}'
11
+ }
12
+
13
+ const LOCATIONS_PATH = '/api/locations';
14
+
15
+ const REFRESH_TOKEN_PATH = '/api/refresh_token';
16
+
17
+ const { RNBackgroundGeolocation } = NativeModules;
18
+
19
+ export default class TransistorAuthorizationToken {
20
+ static findOrCreate(orgname, username, url=DEFAULT_URL) {
21
+
22
+ return new Promise((resolve, reject) => {
23
+ let success = (token) => {
24
+ // Configure Transistor url and refreshPayload. Flutter is so much nice for this stuff.
25
+ token.url = url;
26
+ resolve(token)
27
+ }
28
+ let failure = (error) => {
29
+ console.warn('[TransistorAuthorizationToken findOrCreate] ERROR: ', error);
30
+ // Return a dummy token on error. this is a weird thing to do but it probably failed due to no network connection to demo server.
31
+ // Once app will request the token once again after restarting one's app.
32
+ if (error.status == '403') {
33
+ reject(error);
34
+ return;
35
+ }
36
+ resolve({
37
+ accessToken: DUMMY_TOKEN,
38
+ refreshToken: DUMMY_TOKEN,
39
+ expires: -1,
40
+ url:url
41
+ });
42
+ }
43
+ RNBackgroundGeolocation.getTransistorToken(orgname, username, url, success, failure);
44
+ });
45
+ }
46
+
47
+ static destroy(url=DEFAULT_URL) {
48
+ return new Promise((resolve, reject) => {
49
+ let success = (token) => { resolve(token) }
50
+ let failure = (error) => { reject(error) }
51
+
52
+ RNBackgroundGeolocation.destroyTransistorToken(url, success, failure);
53
+ });
54
+ }
55
+
56
+ static applyIf(config) {
57
+ if (!config.transistorAuthorizationToken) return config;
58
+
59
+ let token = config.transistorAuthorizationToken;
60
+ delete config.transistorAuthorizationToken;
61
+
62
+ config.url = token.url + LOCATIONS_PATH;
63
+ config.authorization = {
64
+ strategy: 'JWT',
65
+ accessToken: token.accessToken,
66
+ refreshToken: token.refreshToken,
67
+ refreshUrl: token.url + REFRESH_TOKEN_PATH,
68
+ refreshPayload: REFRESH_PAYLOAD,
69
+ expires: token.expires
70
+ }
71
+ return config;
72
+ }
73
+ }
@@ -0,0 +1,1601 @@
1
+ /// <reference path="types.d.ts" />
2
+ /// <reference path="interfaces/Config.d.ts" />
3
+ /// <reference path="interfaces/ConnectivityChangeEvent.d.ts" />
4
+ /// <reference path="interfaces/CurrentPositionRequest.d.ts" />
5
+ /// <reference path="interfaces/Geofence.d.ts" />
6
+ /// <reference path="interfaces/GeofenceEvent.d.ts" />
7
+ /// <reference path="interfaces/GeofencesChangeEvent.d.ts" />
8
+ /// <reference path="interfaces/HeartbeatEvent.d.ts" />
9
+ /// <reference path="interfaces/HttpEvent.d.ts" />
10
+ /// <reference path="interfaces/Location.d.ts" />
11
+ /// <reference path="interfaces/LocationAuthorizationAlert.d.ts" />
12
+ /// <reference path="interfaces/Logger.d.ts" />
13
+ /// <reference path="interfaces/MotionActivityEvent.d.ts" />
14
+ /// <reference path="interfaces/MotionChangeEvent.d.ts" />
15
+ /// <reference path="interfaces/ProviderChangeEvent.d.ts" />
16
+ /// <reference path="interfaces/Sensors.d.ts" />
17
+ /// <reference path="interfaces/State.d.ts" />
18
+ /// <reference path="interfaces/WatchPositionRequest.d.ts" />
19
+ /// <reference path="interfaces/DeviceSettings.d.ts" />
20
+ /// <reference path="interfaces/Notification.d.ts" />
21
+ /// <reference path="interfaces/SQLQuery.d.ts" />
22
+ /// <reference path="interfaces/DeviceInfo.d.ts" />
23
+ /// <reference path="interfaces/Authorization.d.ts" />
24
+ /// <reference path="interfaces/AuthorizationEvent.d.ts" />
25
+ /// <reference path="interfaces/TransistorAuthorizationToken.d.ts" />
26
+ ///
27
+ declare module "react-native-background-geolocation" {
28
+ /**
29
+ * Primary API of the SDK.
30
+ * @break
31
+ *
32
+ * ## 📚 Help
33
+ * - 📘 [Philosophy of Operation](github:wiki/Philosophy-of-Operation)
34
+ * - 📘 [[HttpEvent | HTTP Guide]].
35
+ * - 📘 [[Geofence | Geofencing Guide]].
36
+ * - 📘 [Android Headless Mode](github:wiki/Android-Headless-Mode).
37
+ * - 📘 [Debugging Guide](github:wiki/Debugging).
38
+ *
39
+ * ## ⚡️ Events
40
+ *
41
+ * [[BackgroundGeolocation]] is event-based. Interacting with the SDK is largely through implementing listeners on the following events:
42
+ *
43
+ * | Method | Description |
44
+ * |------------------------|-----------------------------------------|
45
+ * | [[onLocation]] | Fired with each recorded [[Location]] |
46
+ * | [[onMotionChange]] | Fired when the plugin changes state between *moving* / *stationary* |
47
+ * | [[onHttp]] | Fired with each HTTP response from your server. (see [[Config.url]]). |
48
+ * | [[onActivityChange]] | Fired with each change in device motion-activity. |
49
+ * | [[onProviderChange]] | Fired after changes to device location-services configuration. |
50
+ * | [[onHeartbeat]] | Periodic timed events. See [[heartbeatInterval]]. iOS requires [[preventSuspend]]. |
51
+ * | [[onGeofence]] | Fired with each [[Geofence]] transition event (`ENTER, EXIT, DWELL`). |
52
+ * | [[onGeofencesChange]] | Fired when the list of actively-monitored geofences changed. See [[geofenceProximityRadius]]. |
53
+ * | [[onSchedule]] | Fired for [[schedule]] events. |
54
+ * | [[onConnectivityChange]] | Fired when network-connectivity changes (connected / disconnected). |
55
+ * | [[onPowerSaveChange]] | Fired when state of operating-system's "power-saving" feature is enabled / disabled. |
56
+ * | [[onEnabledChange]] | Fired when the plugin is enabled / disabled via its [[start]] / [[stop]] methods. |
57
+ * | [[onAuthorization]] | Fired when a response from [[Authorization.refreshUrl]] is received. |
58
+ * | [[onNotificationAction]] | __Android only__: Fired when a button is clicked on a custom [[Notification.layout]] of a foreground-service notification. |
59
+ *
60
+ * ## 🔧 [[Config]] API
61
+ *
62
+ * [[BackgroundGeolocation]] is highly configurable. See the [[Config]] API for more information.
63
+ *
64
+ * There are three main steps to using `BackgroundGeolocation`
65
+ * 1. Wire up event-listeners.
66
+ * 2. [[ready]] the SDK.
67
+ * 3. [[start]] tracking.
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ *
72
+ * ////
73
+ * // 1. Wire up event-listeners
74
+ * //
75
+ *
76
+ * // This handler fires whenever bgGeo receives a location update.
77
+ * BackgroundGeolocation.onLocation(location => {
78
+ * console.log("[location] ", location);
79
+ * }, error => {
80
+ * console.log("[location] ERROR: ", error);
81
+ * });
82
+ *
83
+ * // This handler fires when movement states changes (stationary->moving; moving->stationary)
84
+ * BackgroundGeolocation.onMotionChange(location => {
85
+ * console.log("[motionchange] ", location);
86
+ * });
87
+ *
88
+ * // This handler fires on HTTP responses
89
+ * BackgroundGeolocation.onHttp(response => {
90
+ * console.log("[http] ", response);
91
+ * });
92
+ *
93
+ * // This event fires when a change in motion activity is detected
94
+ * BackgroundGeolocation.onActivityChange(activityEvent => {
95
+ * console.log("[activitychange] ", activityEvent);
96
+ * });
97
+ *
98
+ * // This event fires when the user toggles location-services authorization
99
+ * BackgroundGeolocation.onProviderChange(providerEvent => {
100
+ * console.log("[providerchange] ", providerEvent);
101
+ * });
102
+ *
103
+ * ////
104
+ * // 2. Execute #ready method (required)
105
+ * //
106
+ * BackgroundGeolocation.ready({
107
+ * // Geolocation Config
108
+ * desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
109
+ * distanceFilter: 10,
110
+ * // Activity Recognition
111
+ * stopTimeout: 1,
112
+ * // Application config
113
+ * debug: true, // <-- enable this hear debug sounds.
114
+ * logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
115
+ * stopOnTerminate: false, // <-- Allow the background-service to continue tracking when app terminated.
116
+ * startOnBoot: true, // <-- Auto start tracking when device is powered-up.
117
+ * // HTTP / SQLite config
118
+ * url: "http://yourserver.com/locations",
119
+ * batchSync: false, // <-- Set true to sync locations to server in a single HTTP request.
120
+ * autoSync: true, // <-- Set true to sync each location to server as it arrives.
121
+ * headers: { // <-- Optional HTTP headers
122
+ * "X-FOO": "bar"
123
+ * },
124
+ * params: { // <-- Optional HTTP params
125
+ * "auth_token": "maybe_your_server_authenticates_via_token_YES?"
126
+ * }
127
+ * }, (state) => {
128
+ * console.log("- BackgroundGeolocation is configured and ready: ", state.enabled);
129
+ *
130
+ * if (!state.enabled) {
131
+ * ////
132
+ * // 3. Start tracking!
133
+ * //
134
+ * BackgroundGeolocation.start(function() {
135
+ * console.log("- Start success");
136
+ * });
137
+ * }
138
+ * });
139
+ *
140
+ * ```
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * BackgroundGeolocation.ready({
145
+ * distanceFilter: 10,
146
+ * stopOnTerminate: false,
147
+ * logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
148
+ * debug: true
149
+ * }, (state) => {
150
+ * console.log("- BackgroundGeolocation is ready: ", state);
151
+ * });
152
+ * ```
153
+ *
154
+ * ### ⚠️ Warning:
155
+ * Do not execute *any* API method which will require accessing location-services until the callback to [[ready]] executes (eg: [[getCurrentPosition]], [[watchPosition]], [[start]]).
156
+ *
157
+ * ### Promise API
158
+ *
159
+ * The `BackgroundGeolocation` Javascript API supports [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for *nearly* every method (the exceptions are [[watchPosition]] and adding event-listeners via **`#onEventName`** methods.)
160
+ * @example
161
+ * ```typescript
162
+ * // Traditional API still works:
163
+ * BackgroundGeolocation.ready({desiredAccuracy: 0, distanceFilter: 50}).then(state => {
164
+ * console.log("- BackgroundGeolocation is ready: ", state);
165
+ * }).catch(error => {
166
+ * console.log("- BackgroundGeolocation error: ", error);
167
+ * });
168
+ * ```
169
+ */
170
+ export class BackgroundGeolocation {
171
+ static EVENT_BOOT: Event;
172
+ static EVENT_TERMINATE: Event;
173
+ static EVENT_LOCATION: Event;
174
+ static EVENT_MOTIONCHANGE: Event;
175
+ static EVENT_HTTP: Event;
176
+ static EVENT_HEARTBEAT: Event;
177
+ static EVENT_PROVIDERCHANGE: Event;
178
+ static EVENT_ACTIVITYCHANGE: Event;
179
+ static EVENT_GEOFENCE: Event;
180
+ static EVENT_GEOFENCESCHANGE: Event;
181
+ static EVENT_ENABLEDCHANGE: Event;
182
+ static EVENT_CONNECTIVITYCHANGE: Event;
183
+ static EVENT_SCHEDULE: Event;
184
+ static EVENT_POWERSAVECHANGE: Event;
185
+ static EVENT_NOTIFICATIONACTION: Event;
186
+ static EVENT_AUTHORIZATION: Event;
187
+
188
+ static LOG_LEVEL_OFF: LogLevel;
189
+ static LOG_LEVEL_ERROR: LogLevel;
190
+ static LOG_LEVEL_WARNING: LogLevel;
191
+ static LOG_LEVEL_INFO: LogLevel;
192
+ static LOG_LEVEL_DEBUG: LogLevel;
193
+ static LOG_LEVEL_VERBOSE: LogLevel;
194
+
195
+ static DESIRED_ACCURACY_NAVIGATION:LocationAccuracy;
196
+ static DESIRED_ACCURACY_HIGH:LocationAccuracy;
197
+ static DESIRED_ACCURACY_MEDIUM:LocationAccuracy;
198
+ static DESIRED_ACCURACY_LOW:LocationAccuracy;
199
+ static DESIRED_ACCURACY_VERY_LOW:LocationAccuracy;
200
+ static DESIRED_ACCURACY_LOWEST:LocationAccuracy;
201
+
202
+ static AUTHORIZATION_STATUS_NOT_DETERMINED:AuthorizationStatus;
203
+ static AUTHORIZATION_STATUS_RESTRICTED:AuthorizationStatus;
204
+ static AUTHORIZATION_STATUS_DENIED:AuthorizationStatus;
205
+ static AUTHORIZATION_STATUS_ALWAYS:AuthorizationStatus;
206
+ static AUTHORIZATION_STATUS_WHEN_IN_USE:AuthorizationStatus;
207
+
208
+ static NOTIFICATION_PRIORITY_DEFAULT:NotificationPriority;
209
+ static NOTIFICATION_PRIORITY_HIGH:NotificationPriority;
210
+ static NOTIFICATION_PRIORITY_LOW:NotificationPriority;
211
+ static NOTIFICATION_PRIORITY_MAX:NotificationPriority;
212
+ static NOTIFICATION_PRIORITY_MIN:NotificationPriority;
213
+
214
+ static ACTIVITY_TYPE_OTHER:ActivityType;
215
+ static ACTIVITY_TYPE_AUTOMOTIVE_NAVIGATION:ActivityType;
216
+ static ACTIVITY_TYPE_FITNESS:ActivityType;
217
+ static ACTIVITY_TYPE_OTHER_NAVIGATION:ActivityType;
218
+
219
+ static PERSIST_MODE_ALL: PersistMode;
220
+ static PERSIST_MODE_LOCATION: PersistMode;
221
+ static PERSIST_MODE_GEOFENCE: PersistMode;
222
+ static PERSIST_MODE_NONE: PersistMode;
223
+
224
+ static ACCURACY_AUTHORIZATION_FULL: AccuracyAuthorization;
225
+ static ACCURACY_AUTHORIZATION_REDUCED: AccuracyAuthorization;
226
+
227
+ /**
228
+ * [[DeviceSettings]] API
229
+ *
230
+ * Provides an API to show Android & vendor-specific Battery / Power Management settings screens that can affect performance of the Background Geolocation SDK on various devices.
231
+ *
232
+ * The site [Don't Kill My App](https://dontkillmyapp.com/) provides a comprehensive list of poor Android vendors which throttle background-services that this plugin relies upon.
233
+ *
234
+ * This [[DeviceSettings]] API is an attempt to provide resources to direct the user to the appropriate vendor-specific settings screen to resolve issues with background operation.
235
+ *
236
+ * ![](https://dl.dropboxusercontent.com/s/u7ljngfecxvibyh/huawei-settings-battery-launch.jpg?dl=1)
237
+ * ![](https://dl.dropboxusercontent.com/s/hd6yxw58hgc7ef4/android-settings-battery-optimization.jpg?dl=1)
238
+ *
239
+ */
240
+ static deviceSettings: DeviceSettings;
241
+
242
+ /**
243
+ * [[Logger]] API
244
+ */
245
+ static logger: Logger;
246
+
247
+ /**
248
+ * @hidden
249
+ */
250
+ static addListener(event: string, success:Function, failure?:Function):void;
251
+ /**
252
+ * @hidden
253
+ */
254
+ static on(event: string, success:Function, failure?:Function):void;
255
+ /**
256
+ * Removes an event listener. You must supply the *type* of event to remove in addition to a reference to the *exact* function you
257
+ * used to subscribe to the event.
258
+ *
259
+ *
260
+ * | Event |
261
+ * |----------------------|
262
+ * | `location` |
263
+ * | `motionchange` |
264
+ * | `activitychange` |
265
+ * | `providerchange` |
266
+ * | `geofence` |
267
+ * | `geofenceschange` |
268
+ * | `heartbeat` |
269
+ * | `http` |
270
+ * | `powersavechange` |
271
+ * | `schedule` |
272
+ * | `connectivitychange` |
273
+ * | `enabledchange` |
274
+ *
275
+ * @example
276
+ * ```typescript
277
+ * let locationHandler = (location) => {
278
+ * console.log("[location] - ", location)
279
+ * }
280
+ * BackgroundGeolocation.onLocation(locationHandler)
281
+ * .
282
+ * .
283
+ * // Remove the listener providing a reference to the original callback.
284
+ * BackgroundGeolocation.removeListener("location", locationHandler)
285
+ * ```
286
+ */
287
+ static removeListener(event: string, handler: Function, success?:Function, failure?:Function): void;
288
+
289
+ /**
290
+ * Alias for [[removeListener]].
291
+ * @ignore
292
+ */
293
+ static un(event: string, handler: Function, success?:Function, failure?:Function): void;
294
+
295
+ /**
296
+ * Removes all event-listeners
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * BackgroundGeolocation.removeListeners();
301
+ * ```
302
+ */
303
+ static removeListeners(success?:Function, failure?:Function): Promise<void>;
304
+
305
+ /**
306
+ * Alias for [[removeListeners]]
307
+ */
308
+ static removeAllListeners(success?:Function, failure?:Function): Promise<void>;
309
+
310
+ /**
311
+ * Subscribe to location events.
312
+ *
313
+ * Every location recorded by the SDK is provided to your `callback`, including those from [[onMotionChange]], [[getCurrentPosition]] and [[watchPosition]].
314
+ *
315
+ * @example
316
+ * ```typescript
317
+ * BackgroundGeolocation.onLocation((location) => {
318
+ * console.log("[onLocation] success: ", location);
319
+ * }, (error) => {
320
+ * console.log("[onLocation] ERROR: ", error);
321
+ * });
322
+ * ```
323
+ *
324
+ * ### Error Codes
325
+ *
326
+ * If the native location API fails to return a location, the `failure` callback will be provided a [[LocationError]].
327
+ *
328
+ * ### ⚠️ Note [[Location.sample]]:
329
+ *
330
+ * When performing a [[onMotionChange]] or [[getCurrentPosition]], the plugin requests **multiple** location *samples* in order to record the most accurate location possible. These *samples* are **not** persisted to the database but they will be provided to your `callback`, for your convenience, since it can take some seconds for the best possible location to arrive.
331
+ *
332
+ * For example, you might use these samples to progressively update the user's position on a map. You can detect these *samples* in your `callback` via `location.sample == true`. If you're manually `POST`ing location to your server, you should ignore these locations.
333
+ *
334
+ * @event location
335
+ */
336
+ static onLocation(success: (location:Location)=>void, failure?:(errorCode: LocationError) => void):void;
337
+
338
+ /**
339
+ * Subscribe to Geofence transition events.
340
+ *
341
+ * Your supplied `callback` will be called when any monitored geofence crossing occurs.
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * BackgroundGeolocation.onGeofence((event) => {
346
+ * console.log("[onGeofence] ", event);
347
+ * });
348
+ * ```
349
+ *
350
+ * ### ℹ️ See also:
351
+ * - 📘 [[Geofence | Geofencing Guide]]
352
+ *
353
+ * @event geofence
354
+ */
355
+ static onGeofence(callback: (event: GeofenceEvent) => void):void;
356
+
357
+ /**
358
+ * Subscribe to __`motionchange`__ events.
359
+ *
360
+ * Your `callback` will be executed each time the device has changed-state between **MOVING** or **STATIONARY**.
361
+ *
362
+ *
363
+ * @example
364
+ * ```typescript
365
+ * BackgroundGeolocation.onMotionChange((event) => {
366
+ * if (event.isMoving) {
367
+ * console.log("[onMotionChange] Device has just started MOVING ", event.location);
368
+ * } else {
369
+ * console.log("[onMotionChange] Device has just STOPPED: ", event.location);
370
+ * }
371
+ * });
372
+ * ```
373
+ *
374
+ * ----------------------------------------------------------------------
375
+ * ### ⚠️ Warning: `autoSyncThreshold`
376
+ *
377
+ * If you've configured [[Config.autoSyncThreshold]], it **will be ignored** during a `onMotionChange` event &mdash; all queued locations will be uploaded, since:
378
+ * - If an `onMotionChange` event fires **into the *moving* state**, the device may have been sitting dormant for a long period of time. The plugin is *eager* to upload this state-change to the server as soon as possible.
379
+ * - If an `onMotionChange` event fires **into the *stationary* state**, the device may be about to lie dormant for a long period of time. The plugin is *eager* to upload all queued locations to the server before going dormant.
380
+ * ----------------------------------------------------------------------
381
+ *
382
+ * ### ℹ️ See also:
383
+ * - [[stopTimeout]]
384
+ * - 📘 [Philosophy of Operation](github:wiki/Philosophy-of-Operation)
385
+ *
386
+ * @event motionchange
387
+ */
388
+ static onMotionChange(callback: (event:MotionChangeEvent) => void): void;
389
+
390
+ /**
391
+ * Subscribe to HTTP responses from your server [[Config.url]].
392
+ *
393
+ * @example
394
+ * ```typescript
395
+ * BackgroundGeolocation.onHttp((response) => {
396
+ * let status = response.status;
397
+ * let success = response.success;
398
+ * let responseText = response.responseText;
399
+ * console.log("[onHttp] ", response);
400
+ * });
401
+ * ```
402
+ * ### ℹ️ See also:
403
+ * - [[HttpEvent | HTTP Guide]]
404
+ *
405
+ * @event http
406
+ */
407
+ static onHttp(callback: (response:HttpEvent) => void): void;
408
+
409
+ /**
410
+ * Subscribe to changes in motion activity.
411
+ *
412
+ * Your `callback` will be executed each time the activity-recognition system receives an event (`still, on_foot, in_vehicle, on_bicycle, running`).
413
+ *
414
+ * ### Android
415
+ * Android [[MotionActivityEvent.confidence]] always reports `100`%.
416
+ *
417
+ * @example
418
+ * ```typescript
419
+ * BackgroundGeolocation.onActivityChange((event) => {
420
+ * console.log("[onActivityChange] ", event);
421
+ * });
422
+ * ```
423
+ * @event activitychange
424
+ */
425
+ static onActivityChange(callback: (event: MotionActivityEvent) => void): void;
426
+
427
+ /**
428
+ * Subscribe to changes in device's location-services configuration / authorization.
429
+ *
430
+ * Your `callback` fill be executed whenever a change in the state of the device's **Location Services** has been detected. eg: "GPS ON", "WiFi only".
431
+ *
432
+ * @example
433
+ * ```typescript
434
+ * BackgroundGeolocation.onProviderChange((event) => {
435
+ * console.log("[onProviderChange: ", event);
436
+ *
437
+ * switch(event.status) {
438
+ * case BackgroundGeolocation.AUTHORIZATION_STATUS_DENIED:
439
+ * // Android & iOS
440
+ * console.log("- Location authorization denied");
441
+ * break;
442
+ * case BackgroundGeolocation.AUTHORIZATION_STATUS_ALWAYS:
443
+ * // Android & iOS
444
+ * console.log("- Location always granted");
445
+ * break;
446
+ * case BackgroundGeolocation.AUTHORIZATION_STATUS_WHEN_IN_USE:
447
+ * // iOS only
448
+ * console.log("- Location WhenInUse granted");
449
+ * break;
450
+ * }
451
+ * });
452
+ * ```
453
+ *
454
+ * ### ℹ️ See also:
455
+ * - You can explicitly request the current state of location-services using [[getProviderState]].
456
+ *
457
+ * ### ⚠️ Note:
458
+ * - The plugin always force-fires an [[onProviderChange]] event whenever the app is launched (right after the [[ready]] method is executed), regardless of current state, so you can learn the the current state of location-services with each boot of your application.
459
+ *
460
+ * @event providerchange
461
+ */
462
+ static onProviderChange(callback: (event:ProviderChangeEvent) => void): void;
463
+
464
+ /**
465
+ * Subscribe to periodic heartbeat events.
466
+ *
467
+ * Your `callback` will be executed for each [[heartbeatInterval]] while the device is in **stationary** state (**iOS** requires [[preventSuspend]]: true as well).
468
+ *
469
+ * @example
470
+ * ```typescript
471
+ * BackgroundGeolocation.ready({
472
+ * heartbeatInterval: 60
473
+ * });
474
+ *
475
+ * BackgroundGeolocation.onHeartbeat((event) => {
476
+ * console.log("[onHeartbeat] ", event);
477
+ *
478
+ * // You could request a new location if you wish.
479
+ * BackgroundGeolocation.getCurrentPosition({
480
+ * samples: 1,
481
+ * persist: true
482
+ * }).then((location) => {
483
+ * console.log("[getCurrentPosition] ", location);
484
+ * });
485
+ * })
486
+ * ```
487
+ *
488
+ * ### ⚠️ Note:
489
+ * - The [[Location]] provided by the [[HeartbeatEvent]] is only the last-known location. The *heartbeat* event does not actively engage location-services. If you wish to get the current location in your `callback`, use [[getCurrentPosition]].
490
+ * @event heartbeat
491
+ */
492
+ static onHeartbeat(callback: (event: HeartbeatEvent) => void): void;
493
+
494
+ /**
495
+ * Subscribe to changes in actively monitored geofences.
496
+ *
497
+ * Fired when the list of monitored-geofences changed. The BackgroundGeolocation SDK contains powerful geofencing features that allow you to monitor
498
+ * any number of circular geofences you wish (thousands even), in spite of limits imposed by the native platform APIs (**20 for iOS; 100 for Android**).
499
+ *
500
+ * The plugin achieves this by storing your geofences in its database, using a [geospatial query](https://en.wikipedia.org/wiki/Spatial_query) to determine
501
+ * those geofences in proximity (@see [[geofenceProximityRadius]]), activating only those geofences closest to the device's current location
502
+ * (according to limit imposed by the corresponding platform).
503
+ *
504
+ * When the device is determined to be moving, the plugin periodically queries for geofences in proximity (eg. every minute) using the latest recorded
505
+ * location. This geospatial query is **very fast**, even with tens-of-thousands geofences in the database.
506
+ *
507
+ * It's when this list of monitored geofences *changes*, that the plugin will fire the `onGeofencesChange` event.
508
+ *
509
+ * @example
510
+ * ```typescript
511
+ * BackgroundGeolocation.onGeofencesChange((event) => {
512
+ * let on = event.on; //<-- new geofences activated.
513
+ * let off = event.off; //<-- geofences that were just de-activated.
514
+ *
515
+ * // Create map circles
516
+ * on.forEach((geofence) => {
517
+ * createGeofenceMarker(geofence)
518
+ * });
519
+ *
520
+ * // Remove map circles
521
+ * off.forEach((identifier) => {
522
+ * removeGeofenceMarker(identifier);
523
+ * }
524
+ * });
525
+ * ```
526
+ *
527
+ * ### ℹ️ See also:
528
+ * - 📘 [[Geofence | Geofencing Guide]]
529
+ * @event geofenceschange
530
+ */
531
+ static onGeofencesChange(callback: (event: GeofencesChangeEvent) => void): void;
532
+
533
+ /**
534
+ * Subscribe to [[schedule]] events.
535
+ *
536
+ * Your `callback` will be executed each time a [[schedule]] event fires. Your `callback` will be provided with the current [[State]]: **`state.enabled`**
537
+ * will reflect the state according to your [[schedule]].
538
+ *
539
+ * @example
540
+ * ```typescript
541
+ * BackgroundGeolocation.onSchedule((state) => {
542
+ * if (state.enabled) {
543
+ * console.log("[onSchedule] scheduled start tracking");
544
+ * } else {
545
+ * console.log("[onSchedule] scheduled stop tracking");
546
+ * }
547
+ * });
548
+ * ```
549
+ * @event schedule
550
+ */
551
+ static onSchedule(callback: (state:State) => void): void;
552
+
553
+ /**
554
+ * Subscribe to changes in network connectivity.
555
+ *
556
+ * Fired when the state of the device's network-connectivity changes (enabled -> disabled and vice-versa). By default, the plugin will automatically fire
557
+ * a `connectivitychange` event with the current state network-connectivity whenever the [[start]] method is executed.
558
+ *
559
+ * ℹ️ The SDK subscribes internally to `connectivitychange` events &mdash; if you've configured the SDK's HTTP Service (See [[HttpEvent | HTTP Guide]]) and your app has queued locations,
560
+ * the SDK will automatically initiate uploading to your configured [[Config.url]] when network connectivity is detected.
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * BackgroundGeolocation.onConnectivityChange((event) => {
565
+ * console.log("[onConnectivityChange] ", event);
566
+ * });
567
+ * ```
568
+ * @event connectivitychange
569
+ */
570
+ static onConnectivityChange(callback: (event:ConnectivityChangeEvent) => void): void;
571
+
572
+ /**
573
+ * Subscribe to state changes in OS power-saving system.
574
+ *
575
+ * Fired when the state of the operating-system's "Power Saving" mode changes. Your `callback` will be provided with a `bool` showing whether
576
+ * "Power Saving" is **enabled** or **disabled**. Power Saving mode can throttle certain services in the background, such as HTTP requests or GPS.
577
+ * @break
578
+ *
579
+ * ℹ️ You can manually request the current-state of "Power Saving" mode with the method [[isPowerSaveMode]].
580
+ *
581
+ * ### iOS
582
+ *
583
+ * iOS Power Saving mode can be engaged manually by the user in **Settings -> Battery** or from an automatic OS dialog.
584
+ *
585
+ * ![](https://dl.dropboxusercontent.com/s/lz3zl2jg4nzstg3/Screenshot%202017-09-19%2010.34.21.png?dl=1)
586
+ *
587
+ * ### Android
588
+ *
589
+ * Android Power Saving mode can be engaged manually by the user in **Settings -> Battery -> Battery Saver** or automatically with a user-specified "threshold" (eg: 15%).
590
+ *
591
+ * ![](https://dl.dropboxusercontent.com/s/raz8lagrqayowia/Screenshot%202017-09-19%2010.33.49.png?dl=1)
592
+ *
593
+ * @example
594
+ * ```typescript
595
+ * BackgroundGeolocation.onPowerSaveChange((isPowerSaveMode) => {
596
+ * console.log("[onPowerSaveChange: ", isPowerSaveMode);
597
+ * });
598
+ * ```
599
+ * @event powersavechange
600
+ */
601
+ static onPowerSaveChange(callback: (enabled:boolean) => void): void;
602
+
603
+ /**
604
+ * Subscribe to changes in plugin [[State.enabled]].
605
+ *
606
+ * Fired when the SDK's [[State.enabled]] changes. For example, executing [[start]] and [[stop]] will cause the `onEnabledChnage` event to fire.
607
+ * This event is primarily designed for use with the configuration option [[stopAfterElapsedMinutes]], which automatically executes the SDK's
608
+ * [[stop]] method.
609
+ *
610
+ * @example
611
+ * ```typescript
612
+ * BackgroundGeolocation.onEnabledChange(isEnabled => {
613
+ * console.log("[onEnabledChanged] isEnabled? ", isEnabled);
614
+ * });
615
+ * ```
616
+ * @event enabledchange
617
+ */
618
+ static onEnabledChange(callback: (enabled:boolean) => void): void;
619
+
620
+ /**
621
+ * [__Android-only__] Subscribe to button-clicks of a custom [[Notification.layout]] on the Android foreground-service notification.
622
+ */
623
+ static onNotificationAction(callback: (buttonId:string) => void): void;
624
+
625
+ /**
626
+ * Subscribe to [[Authorization]] events.
627
+ *
628
+ * Fired when [[Authorization.refreshUrl]] responds, either successfully or not. If successful, [[AuthorizationEvent.success]] will be `true` and [[AuthorizationEvent.response]] will
629
+ * contain the decoded JSON response returned from the server.
630
+ *
631
+ * If authorization failed, [[AuthorizationEvent.error]] will contain the error message.
632
+ *
633
+ * @example
634
+ * ```typescript
635
+ * BackgroundGeolocation.onAuthorization((event) => {
636
+ * if (event.success) {
637
+ * console.log("[authorization] ERROR: ", event.error);
638
+ * } else {
639
+ * console.log("[authorization] SUCCESS: ", event.response);
640
+ * }
641
+ * });
642
+ * ```
643
+ *
644
+ */
645
+ static onAuthorization(callback: (event:AuthorizationEvent) => void): void;
646
+
647
+ /**
648
+ * Registers a Javascript callback to execute in the Android "Headless" state, where the app has been terminated configured with
649
+ * [[stopOnTerminate]]`:false`. * The received `event` object contains a `name` (the event name) and `params` (the event data-object).
650
+ *
651
+ * ### ⚠️ Note Cordova
652
+ * - Javascript headless callbacks are not supported by Cordova.
653
+ *
654
+ * ### ⚠️ Warning:
655
+ * - You __must__ `registerHeadlessTask` in your application root file (eg: `index.js`).
656
+ *
657
+ * @example
658
+ * ```typescript
659
+ * let BackgroundGeolocationHeadlessTask = async (event) => {
660
+ * let params = event.params;
661
+ * console.log("[BackgroundGeolocation HeadlessTask] -", event.name, params);
662
+ *
663
+ * switch (event.name) {
664
+ * case "heartbeat":
665
+ * // Use await for async tasks
666
+ * let location = await BackgroundGeolocation.getCurrentPosition({
667
+ * samples: 1,
668
+ * persist: false
669
+ * });
670
+ * console.log("[BackgroundGeolocation HeadlessTask] - getCurrentPosition:", location);
671
+ * break;
672
+ * }
673
+ * }
674
+ *
675
+ * BackgroundGeolocation.registerHeadlessTask(BackgroundGeolocationHeadlessTask);
676
+ * ```
677
+ *
678
+ * ### ℹ️ See also:
679
+ * - 📘 [Android Headless Mode](github:wiki/Android-Headless-Mode).
680
+ *
681
+ */
682
+ static registerHeadlessTask(callback:(event:Object)=>any): void;
683
+
684
+ /**
685
+ *
686
+ * Signal to the plugin that your app is launched and ready, proving the default [[Config]].
687
+ *
688
+ * The supplied [[Config]] will be applied **only at first install** of your app — for every launch thereafter,
689
+ * the plugin will automatically load its last-known configuration from persistent storage.
690
+ * The plugin always remembers the configuration you apply to it.
691
+ *
692
+ * @example
693
+ * ```typescript
694
+ * BackgroundGeolocation.ready({
695
+ * desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
696
+ * distanceFilter: 10,
697
+ * stopOnTerminate: false,
698
+ * startOnBoot: true,
699
+ * url: "http://your.server.com",
700
+ * headers: {
701
+ * "my-auth-token": "secret-token"
702
+ * }
703
+ * }).then((state) => {
704
+ * console.log("[ready] success", state);
705
+ * });
706
+ * ```
707
+ *
708
+ * ### ⚠️ Warning: You must call `#ready` **once** and **only** once, each time your app is launched.
709
+ * - Do not hide the call to `#ready` within a view which is loaded only by clicking a UI action. This is particularly important
710
+ * for iOS in the case where the OS relaunches your app in the background when the device is detected to be moving. If you don't ensure that `#ready` is called in this case, tracking will not resume.
711
+ *
712
+ * ### The [[reset]] method.
713
+ *
714
+ * If you wish, you can use the [[reset]] method to reset all [[Config]] options to documented default-values (with optional overrides):
715
+ *
716
+ * @example
717
+ * ```typescript
718
+ * BackgroundGeolocation.reset();
719
+ * // Reset to documented default-values with overrides
720
+ * bgGeo.reset({
721
+ * distanceFilter: 10
722
+ * });
723
+ * ```
724
+ */
725
+ static ready(config: Config, success?:(state:State) => void, failure?:(error:string) => void): Promise<State>;
726
+
727
+ /**
728
+ * @ignore
729
+ * __DEPRECATED__. Use [[ready]] instead.
730
+ */
731
+ static configure(config: Config, success?:(state:State) => void, failure?:Function): Promise<State>;
732
+
733
+ /**
734
+ *
735
+ * Re-configure the SDK's [[Config]] parameters. This is the method to use when you wish to *change*
736
+ * the plugin [[Config]] *after* [[ready]] has been executed.
737
+ *
738
+ * The supplied [[Config]] will be appended to the current configuration and applied in realtime.
739
+ *
740
+ * @example
741
+ * ```typescript
742
+ * BackgroundGeolocation.setConfig({
743
+ * desiredAccuracy: Config.DESIRED_ACCURACY_HIGH,
744
+ * distanceFilter: 100.0,
745
+ * stopOnTerminate: false,
746
+ * startOnBoot: true
747
+ * }).then((state) => {
748
+ * console.log("[setConfig] success: ", state);
749
+ * })
750
+ * ```
751
+ */
752
+ static setConfig(config: Config, success?:(state:State) => void, failure?:Function): Promise<State>;
753
+
754
+ /**
755
+ * Resets the plugin configuration to documented default-values.
756
+ *
757
+ * If an optional [[Config]] is provided, it will be applied *after* the configuration reset.
758
+ *
759
+ */
760
+ static reset(config?:Config, success?:(state:State) => void, failure?:Function): Promise<State>;
761
+
762
+ /**
763
+ * Enable location + geofence tracking.
764
+ *
765
+ * This is the SDK's power **ON** button. The plugin will initially start into its **stationary** state, fetching an initial location before
766
+ * turning off location services. Android will be monitoring its **Activity Recognition System** while iOS will create a stationary geofence around
767
+ * the current location.
768
+ *
769
+ * ### ⚠️ Note:
770
+ * If you've configured a [[schedule]], this method will override that schedule and engage tracking immediately.
771
+ *
772
+ * @example
773
+ * ```typescript
774
+ * BackgroundGeolocation.start().then((state) => {
775
+ * console.log("[start] success - ", state);
776
+ * });
777
+ * ```
778
+ *
779
+ * ### ℹ️ See also:
780
+ * - [[stop]]
781
+ * - [[startGeofences]]
782
+ * - 📘 [Philosophy of Operation](github:wiki/Philosophy-of-Operation)
783
+ */
784
+ static start(success?:(state:State) => void, error?:(error:string) => void): Promise<State>;
785
+
786
+ /**
787
+ * Disable location and geofence monitoring. This is the SDK's power **OFF** button.
788
+ *
789
+ * @example
790
+ * ```typescript
791
+ * BackgroundGeolocation.stop();
792
+ * ```
793
+ *
794
+ * ### ⚠️ Note:
795
+ * If you've configured a [[schedule]], **`#stop`** will **not** halt the Scheduler. You must explicitly [[stopSchedule]] as well:
796
+ *
797
+ * @example
798
+ * ```typescript
799
+ * // Later when you want to stop the Scheduler (eg: user logout)
800
+ * BackgroundGeolocation.stopSchedule();
801
+ * ```
802
+ */
803
+ static stop(success?:(state:State) => void, error?: (error:string) => void): Promise<State>;
804
+
805
+ /**
806
+ * Manually toggles the SDK's **motion state** between **stationary** and **moving**.
807
+ *
808
+ * When provided a value of **`true`**, the plugin will engage location-services and begin aggressively tracking the device's location *immediately*,
809
+ * bypassing stationary monitoring.
810
+ *
811
+ * If you were making a "Jogging" application, this would be your **`[Start Workout]`** button to immediately begin location-tracking. Send **`false`**
812
+ * to turn **off** location-services and return the plugin to the **stationary** state.
813
+ *
814
+ * @example
815
+ * ```typescript
816
+ * BackgroundGeolocation.changePace(true); // <-- Location-services ON ("moving" state)
817
+ * BackgroundGeolocation.changePace(false); // <-- Location-services OFF ("stationary" state)
818
+ * ```
819
+ */
820
+ static changePace(isMoving:boolean, success?: Function, failure?:(error:string) => void): Promise<void>;
821
+
822
+ /**
823
+ * Engages the geofences-only [[State.trackingMode]].
824
+ *
825
+ * In this mode, no active location-tracking will occur &mdash; only geofences will be monitored. To stop monitoring "geofences" [[TrackingMode]],
826
+ * simply use the usual [[stop]] method.
827
+ *
828
+ * @example
829
+ * ```typescript
830
+ * // Add a geofence.
831
+ * BackgroundGeolocation.addGeofence({
832
+ * notifyOnExit: true,
833
+ * radius: 200,
834
+ * identifier: "ZONE_OF_INTEREST",
835
+ * latitude: 37.234232,
836
+ * longitude: 42.234234
837
+ * });
838
+ *
839
+ * // Listen to geofence events.
840
+ * BackgroundGeolocation.onGeofence((event) => {
841
+ * console.log("[onGeofence] - ", event);
842
+ * });
843
+ *
844
+ * // Configure the plugin
845
+ * BackgroundGeolocation.ready({
846
+ * url: "http://my.server.com",
847
+ * autoSync: true
848
+ * }).then(((state) => {
849
+ * // Start monitoring geofences.
850
+ * BackgroundGeolocation.startGeofences();
851
+ * });
852
+ * ```
853
+ *
854
+ * ### ℹ️ See also:
855
+ * - [[stop]]
856
+ * - 📘 [[Geofence | Geofencing Guide]]
857
+ */
858
+ static startGeofences(success?:(state:State) => void, failure?:(error:string) => void): Promise<State>;
859
+
860
+ /**
861
+ * Return the current [[State]] of the plugin, including all [[Config]] parameters.
862
+ *
863
+ * @example
864
+ * ```typescript
865
+ * let state = await BackgroundGeolocation.getState();
866
+ * console.log("[state] ", state.enabled, state.trackingMode);
867
+ * ```
868
+ */
869
+ static getState(success?: (state:State) => void, failure?: (error:string) => void): Promise<State>;
870
+
871
+ /**
872
+ * Initiate the configured [[schedule]].
873
+ *
874
+ * If a [[schedule]] was configured, this method will initiate that schedule. The plugin will automatically be started or stopped according to
875
+ * the configured [[schedule]].
876
+ *
877
+ * To halt scheduled tracking, use [[stopSchedule]].
878
+ *
879
+ * @example
880
+ * ```typescript
881
+ * BackgroundGeolocation.startSchedule.then((state) => {
882
+ * console.log("[startSchedule] success: ", state);
883
+ * })
884
+ * ```
885
+ * ### ℹ️ See also:
886
+ * - [[schedule]]
887
+ * - [[startSchedule]]
888
+ */
889
+ static startSchedule(success?: (state:State) => void, failure?: (error:string) => void): Promise<State>;
890
+
891
+ /**
892
+ * Halt scheduled tracking.
893
+ *
894
+ * @example
895
+ * ```typescript
896
+ * BackgroundGeolocation.stopSchedule.then((state) => {
897
+ * console.log("[stopSchedule] success: ", state);
898
+ * })
899
+ * ```
900
+ *
901
+ * ⚠️ [[stopSchedule]] will **not** execute [[stop]] if the plugin is currently tracking. You must explicitly execute [[stop]].
902
+ *
903
+ * @example
904
+ * ```typescript
905
+ * // Later when you want to stop the Scheduler (eg: user logout)
906
+ * await BackgroundGeolocation.stopSchedule().then((state) => {
907
+ * if (state.enabled) {
908
+ * BackgroundGeolocation.stop();
909
+ * }
910
+ * })
911
+ * ```
912
+ * ### ℹ️ See also:
913
+ * - [[startSchedule]]
914
+ *
915
+ */
916
+ static stopSchedule(success?: (state:State) => void, failure?: (error:string) => void): Promise<State>;
917
+
918
+ /**
919
+ * Sends a signal to OS that you wish to perform a long-running task.
920
+ *
921
+ * The will will keep your running in the background and not suspend it until you signal completion with the [[stopBackgroundTask]] method. Your callback will be provided with a single parameter `taskId`
922
+ * which you will send to the [[stopBackgroundTask]] method.
923
+ *
924
+ * @example
925
+ * ```typescript
926
+ * onLocation(location) {
927
+ * console.log("[location] ", location);
928
+ *
929
+ * // Perform some long-running task (eg: HTTP request)
930
+ * BackgroundGeolocation.startBackgroundTask().then((taskId) => {
931
+ * performLongRunningTask.then(() => {
932
+ * // When your long-running task is complete, signal completion of taskId.
933
+ * BackgroundGeolocation.stopBackgroundTask(taskId);
934
+ * }).catch(error) => {
935
+ * // Be sure to catch errors: never leave you background-task hanging.
936
+ * console.error(error);
937
+ * BackgroundGeolocation.stopBackgroundTask();
938
+ * });
939
+ * });
940
+ * }
941
+ * ```
942
+ *
943
+ * ### iOS
944
+ * The iOS implementation uses [beginBackgroundTaskWithExpirationHandler](https://developer.apple.com/documentation/uikit/uiapplication/1623031-beginbackgroundtaskwithexpiratio)
945
+ *
946
+ * ⚠️ iOS provides **exactly** 180s of background-running time. If your long-running task exceeds this time, the plugin has a fail-safe which will
947
+ * automatically [[stopBackgroundTask]] your **`taskId`** to prevent the OS from force-killing your application.
948
+ *
949
+ * Logging of iOS background tasks looks like this:
950
+ * ```
951
+ * ✅-[BackgroundTaskManager createBackgroundTask] 1
952
+ * .
953
+ * .
954
+ * .
955
+ *
956
+ * ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 1 OF (
957
+ * 1
958
+ * )
959
+ * ```
960
+ * ### Android
961
+ *
962
+ * The Android implementation launches a foreground-service, along with the accompanying persistent foreground [[Notification]].
963
+ *
964
+ * ⚠️ The Android plugin hardcodes a limit of **30s** for your background-task before it automatically `FORCE KILL`s it.
965
+ *
966
+ *
967
+ * Logging for Android background-tasks looks like this (when you see an hourglass ⏳ icon, a foreground-service is active)
968
+ * ```
969
+ * I TSLocationManager: [c.t.l.u.BackgroundTaskManager onStartJob] ⏳ startBackgroundTask: 6
970
+ * .
971
+ * .
972
+ * .
973
+ * I TSLocationManager: [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 6
974
+ * ```
975
+ *
976
+ */
977
+ static startBackgroundTask(success?: (taskId:number) => void, failure?: Function): Promise<number>;
978
+
979
+ /**
980
+ * Signal completion of [[startBackgroundTask]]
981
+ *
982
+ * Sends a signal to the native OS that your long-running task, addressed by `taskId` provided by [[startBackgroundTask]] is complete and the OS may proceed
983
+ * to suspend your application if applicable.
984
+ *
985
+ * @example
986
+ * ```typescript
987
+ * BackgroundGeolocation.startBackgroundTask().then((taskId) => {
988
+ * // Perform some long-running task (eg: HTTP request)
989
+ * performLongRunningTask.then(() => {
990
+ * // When your long-running task is complete, signal completion of taskId.
991
+ * BackgroundGeolocation.stopBackgroundTask(taskId);
992
+ * });
993
+ * });
994
+ * ```
995
+ */
996
+ static stopBackgroundTask(taskId: number, success?: Function, failure?: Function): Promise<number>;
997
+
998
+ /**
999
+ * @alias [[stopBackgroundTask]]
1000
+ * @deprecated
1001
+ */
1002
+ static finish(taskId: number, success?: Function, failure?: Function): Promise<number>;
1003
+
1004
+ /**
1005
+ * Retrieves the current [[Location]].
1006
+ *
1007
+ * This method instructs the native code to fetch exactly one location using maximum power & accuracy. The native code will persist the fetched location to
1008
+ * its SQLite database just as any other location in addition to POSTing to your configured [[Config.url]].
1009
+ * If an error occurs while fetching the location, `catch` will be provided with an [[LocationError]].
1010
+ * @break
1011
+ *
1012
+ * ### Options
1013
+ *
1014
+ * See [[CurrentPositionRequest]].
1015
+ *
1016
+ * ### Error Codes
1017
+ *
1018
+ * See [[LocationError]].
1019
+ *
1020
+ * @example
1021
+ * ```typescript
1022
+ * let location = await BackgroundGeolocation.getCurrentPosition({
1023
+ * timeout: 30, // 30 second timeout to fetch location
1024
+ * maximumAge: 5000, // Accept the last-known-location if not older than 5000 ms.
1025
+ * desiredAccuracy: 10, // Try to fetch a location with an accuracy of `10` meters.
1026
+ * samples: 3, // How many location samples to attempt.
1027
+ * extras: { // Custom meta-data.
1028
+ * "route_id": 123
1029
+ * }
1030
+ * });
1031
+ * ```
1032
+ * ### ⚠️ Note:
1033
+ * - While [[getCurrentPosition]] will receive only **one** [[Location]], the plugin *does* request **multiple** location samples which will all be provided
1034
+ * to the [[onLocation]] event-listener. You can detect these samples via [[Location.sample]] `== true`.
1035
+ */
1036
+ static getCurrentPosition(options: CurrentPositionRequest, success?:(location:Location) => void, failure?:(errorCode:LocationError) => void): Promise<Location>;
1037
+
1038
+ /**
1039
+ * Start a stream of continuous location-updates. The native code will persist the fetched location to its SQLite database
1040
+ * just as any other location (If the SDK is currently [[State.enabled]]) in addition to POSTing to your configured [[Config.url]] (if you've enabled the HTTP features).
1041
+ *
1042
+ * ### ⚠️ Warning:
1043
+ * `watchPosition` is **not** recommended for **long term** monitoring in the background &mdash; It's primarily designed for use in the foreground **only**. You might use it for fast-updates of the user's current position on the map, for example.
1044
+ * The SDK's primary [Philosophy of Operation](github:wiki/Philosophy-of-Operation) **does not require** `watchPosition`.
1045
+ *
1046
+ * #### iOS
1047
+ * `watchPosition` will continue to run in the background, preventing iOS from suspending your application. Take care to listen to `suspend` event and call [[stopWatchPosition]] if you don't want your app to keep running in the background, consuming battery.
1048
+ *
1049
+ * @example
1050
+ * ```typescript
1051
+ * onResume() {
1052
+ * // Start watching position while app in foreground.
1053
+ * BackgroundGeolocation.watchPosition((location) => {
1054
+ * console.log("[watchPosition] -", location);
1055
+ * }, (errorCode) => {
1056
+ * console.log("[watchPosition] ERROR -", errorCode);
1057
+ * }, {
1058
+ * interval: 1000
1059
+ * })
1060
+ * }
1061
+ *
1062
+ * onSuspend() {
1063
+ * // Halt watching position when app goes to background.
1064
+ * BackgroundGeolocation.stopWatchPosition();
1065
+ * }
1066
+ * ```
1067
+ */
1068
+ static watchPosition(success: (location:Location) => void, failure?: (errorCode:LocationError) => void, options?: WatchPositionRequest): void;
1069
+
1070
+ /**
1071
+ * Stop watch-position updates initiated from [[watchPosition]].
1072
+ * @example
1073
+ * ```typescript
1074
+ * onResume() {
1075
+ * // Start watching position while app in foreground.
1076
+ * BackgroundGeolocation.watchPosition((location) => {
1077
+ * console.log("[watchPosition] -", location);
1078
+ * }, (errorCode) => {
1079
+ * console.log("[watchPosition] ERROR -", errorCode);
1080
+ * }, {
1081
+ * interval: 1000
1082
+ * })
1083
+ * }
1084
+ *
1085
+ * onSuspend() {
1086
+ * // Halt watching position when app goes to background.
1087
+ * BackgroundGeolocation.stopWatchPosition();
1088
+ * }
1089
+ * ```
1090
+ * ### ℹ️ See also:
1091
+ * - [[stopWatchPosition]]
1092
+ *
1093
+ */
1094
+ static stopWatchPosition(success?: Function, failure?: Function): Promise<void>;
1095
+
1096
+ /**
1097
+ * Retrieve a List of [[Location]] currently stored in the SDK's SQLite database.
1098
+ *
1099
+ * @example
1100
+ * ```typescript
1101
+ * let locations = await BackgroundGeolocation.getLocations();
1102
+ * ```
1103
+ */
1104
+ static getLocations(success?:(locations:Array<Object>) => void, failure?:Function): Promise<Array<Object>>;
1105
+
1106
+ /**
1107
+ * Retrieve the count of all locations current stored in the SDK's SQLite database.
1108
+ *
1109
+ * @example
1110
+ * ```typescript
1111
+ * let count = await BackgroundGeolocation.getCount();
1112
+ * ```
1113
+ */
1114
+ static getCount(success?:(count:number)=>void, failure?:Function): Promise<number>;
1115
+
1116
+ /**
1117
+ * Remove all records in SDK's SQLite database.
1118
+ *
1119
+ * @example
1120
+ * ```typescript
1121
+ * let success = await BackgroundGeolocation.destroyLocations();
1122
+ * ```
1123
+ */
1124
+ static destroyLocations(success?:Function, failure?:Function): Promise<void>;
1125
+
1126
+ /**
1127
+ * Destroy a single location by [[Location.uuid]]
1128
+ *
1129
+ * @example
1130
+ * ```typescript
1131
+ * await BackgroundGeolocation.destroyLocation(location.uuid);
1132
+ * ```
1133
+ */
1134
+ static destroyLocation(uuid:String): Promise<void>;
1135
+
1136
+ static insertLocation(params:Location, success?:(location:Location) => void, failure?:Function): Promise<Location>;
1137
+
1138
+ /**
1139
+ * Manually execute upload to configured [[Config.url]]
1140
+ *
1141
+ * If the plugin is configured for HTTP with an [[Config.url]] and [[autoSync]] `false`, the [[sync]] method will initiate POSTing the locations
1142
+ * currently stored in the native SQLite database to your configured [[Config.url]]. When your HTTP server returns a response of `200 OK`, that record(s)
1143
+ * in the database will be DELETED.
1144
+ *
1145
+ * If you configured [[batchSync]] `true`, all the locations will be sent to your server in a single HTTP POST request, otherwise the plugin will
1146
+ * execute an HTTP post for **each** [[Location]] in the database (REST-style). Your callback will be executed and provided with a `List` of all the
1147
+ * locations from the SQLite database. If you configured the plugin for HTTP (by configuring a [[Config.url]], your callback will be executed after all
1148
+ * the HTTP request(s) have completed. If the plugin failed to sync to your server (possibly because of no network connection), the failure callback will
1149
+ * be called with an error message. If you are **not** using the HTTP features, [[sync]] will delete all records from its SQLite database.
1150
+ *
1151
+ * @example
1152
+ * ```typescript
1153
+ * BackgroundGeolocation.sync((records) => {
1154
+ * console.log("[sync] success: ", records);
1155
+ * }).catch((error) => {
1156
+ * console.log("[sync] FAILURE: ", error);
1157
+ * });
1158
+ *
1159
+ * ```
1160
+ * ℹ️ For more information, see the [[HttpEvent | HTTP Guide]]
1161
+ */
1162
+ static sync(success?:(locations:Array<Object>) => void, failure?:Function): Promise<Array<Object>>;
1163
+
1164
+ /**
1165
+ * Retrieve the current distance-traveled ("odometer").
1166
+ *
1167
+ * The plugin constantly tracks distance traveled, computing the distance between the current location and last and maintaining the sum. To fetch the
1168
+ * current **odometer** reading:
1169
+ *
1170
+ * @example
1171
+ * ```typescript
1172
+ * let odometer = await BackgroundGeolocation.getOdometer();
1173
+ * ```
1174
+ *
1175
+ * ### ℹ️ See also:
1176
+ * - [[desiredOdometerAccuracy]].
1177
+ * - [[resetOdometer]] / [[setOdometer]].
1178
+ *
1179
+ * ### ⚠️ Warning:
1180
+ * - Odometer calculations are dependent upon the accuracy of received locations. If location accuracy is poor, this will necessarily introduce error into odometer calculations.
1181
+ */
1182
+ static getOdometer(success?:(odometer:number) => void, failure?:Function): Promise<number>;
1183
+
1184
+ /**
1185
+ * Initialize the `odometer` to *any* arbitrary value.
1186
+ *
1187
+ * @example
1188
+ * ```typescript
1189
+ * BackgroundGeolocation.setOdometer(1234.56).then((location) => {
1190
+ * // This is the location where odometer was set at.
1191
+ * console.log("[setOdometer] success: ", location);
1192
+ * });
1193
+ * ```
1194
+ *
1195
+ * ### ⚠️ Note:
1196
+ * - [[setOdometer]] will internally perform a [[getCurrentPosition]] in order to record the exact location *where* odometer was set.
1197
+ */
1198
+ static setOdometer(value:number, success?:(location:Location) => void, failure?:Function): Promise<Location>;
1199
+
1200
+ /**
1201
+ * Initialize the `odometer` to `0`.
1202
+ *
1203
+ * @example
1204
+ * ```typescript
1205
+ * BackgroundGeolocation.resetOdometer().then((location) => {
1206
+ * // This is the location where odometer was set at.
1207
+ * console.log("[setOdometer] success: ", location);
1208
+ * });
1209
+ * ```
1210
+ *
1211
+ * ### ⚠️ Note:
1212
+ * - [[resetOdometer]] will internally perform a [[getCurrentPosition]] in order the record to exact location *where* odometer was set.
1213
+ * - [[resetOdometer]] is the same as [[setOdometer]]`:0`.
1214
+ */
1215
+ static resetOdometer(success?:Function, failure?:Function): Promise<Location>;
1216
+
1217
+ /**
1218
+ * Adds a [[Geofence]] to be monitored by the native Geofencing API.
1219
+ *
1220
+ * @example
1221
+ * ```typescript
1222
+ * BackgroundGeolocation.addGeofence({
1223
+ * identifier: "Home",
1224
+ * radius: 150,
1225
+ * latitude: 45.51921926,
1226
+ * longitude: -73.61678581,
1227
+ * notifyOnEntry: true,
1228
+ * notifyOnExit: false,
1229
+ * notifyOnDwell: true,
1230
+ * loiteringDelay: 30000, // 30 seconds
1231
+ * extras: { // Optional arbitrary meta-data
1232
+ * zone_id: 1234
1233
+ * }
1234
+ * }).then((success) => {
1235
+ * console.log("[addGeofence] success");
1236
+ * }).catch((error) => {
1237
+ * console.log("[addGeofence] FAILURE: ", error);
1238
+ * });
1239
+ * ```
1240
+ *
1241
+ * ### ℹ️ Note:
1242
+ * - If a geofence(s) *already* exists with the configured [[Geofence.identifier]], the previous one(s) will be **deleted** before the new one is inserted.
1243
+ * - When adding *multiple*, it's about **10 times faster** to use [[addGeofences]] instead.
1244
+ * - 📘 [[Geofence | Geofencing Guide]]
1245
+ */
1246
+
1247
+ static addGeofence(config:Geofence, success?:Function, failure?:(error:string) => void): Promise<void>;
1248
+ /**
1249
+ * Adds a list of [[Geofence]] to be monitored by the native Geofencing API.
1250
+ *
1251
+ * @example
1252
+ * ```typescript
1253
+ * let geofences = [{
1254
+ * identifier: "foo",
1255
+ * radius: 200,
1256
+ * latitude: 45.51921926,
1257
+ * longitude: -73.61678581,
1258
+ * notifyOnEntry: true
1259
+ * },
1260
+ * identifier: "bar",
1261
+ * radius: 200,
1262
+ * latitude: 45.51921926,
1263
+ * longitude: -73.61678581,
1264
+ * notifyOnEntry: true
1265
+ * }];
1266
+ *
1267
+ * BackgroundGeolocation.addGeofences(geofences);
1268
+ * ```
1269
+ *
1270
+ * ### ℹ️ Note:
1271
+ * - If a geofence(s) *already* exists with the configured [[Geofence.identifier]], the previous one(s) will be **deleted** before the new one is inserted.
1272
+ * - 📘 [[Geofence | Geofencing Guide]]
1273
+ * - [[addGeofence]]
1274
+ *
1275
+ */
1276
+ static addGeofences(geofences: Array<Geofence>, success?: Function, failure?: Function): Promise<void>;
1277
+
1278
+ /**
1279
+ * Removes a [[Geofence]] having the given [[Geofence.identifier]].
1280
+ *
1281
+ * @example
1282
+ * ```typescript
1283
+ * BackgroundGeolocation.removeGeofence("Home").then((success) => {
1284
+ * console.log("[removeGeofence] success");
1285
+ * }).catch((error) => {
1286
+ * console.log("[removeGeofence] FAILURE: ", error);
1287
+ * });
1288
+ * ```
1289
+ *
1290
+ * ### ℹ️ See also:
1291
+ * - 📘 [[Geofence | Geofencing Guide]]
1292
+ */
1293
+ static removeGeofence(identifier: string, success?: Function, failure?: Function): Promise<void>;
1294
+
1295
+ /**
1296
+ * Destroy all [[Geofence]]
1297
+ *
1298
+ * @example
1299
+ * ```typescript
1300
+ * BackgroundGeolocation.removeGeofences();
1301
+ * ```
1302
+ *
1303
+ * ### ℹ️ See also:
1304
+ * - 📘 [[Geofence | Geofencing Guide]]
1305
+ */
1306
+ static removeGeofences(success?: Function, failure?: Function): Promise<void>;
1307
+
1308
+ /**
1309
+ * Fetch a list of all [[Geofence]] in the SDK's database. If there are no geofences being monitored, you'll receive an empty `Array`.
1310
+ *
1311
+ * @example
1312
+ * ```typescript
1313
+ * let geofences = await BackgroundGeolocation.getGeofences();
1314
+ * console.log("[getGeofences: ", geofences);
1315
+ * ```
1316
+ * ### ℹ️ See also:
1317
+ * - 📘 [[Geofence | Geofencing Guide]]
1318
+ */
1319
+ static getGeofences(success?:(geofences:Array<Geofence>) => void, failure?: (error:string) => void): Promise<Array<Geofence>>;
1320
+
1321
+ /**
1322
+ * Fetch a single [[Geofence]] by identifier from the SDK's database.
1323
+ *
1324
+ * @example
1325
+ * ```typescript
1326
+ * let geofence = await BackgroundGeolocation.getGeofence("HOME");
1327
+ * console.log("[getGeofence] ", geofence);
1328
+ * ```
1329
+ *
1330
+ * ### ℹ️ See also:
1331
+ * - 📘 [[Geofence | Geofencing Guide]]
1332
+ */
1333
+ static getGeofence(identifier:string, success?:(geofence:Geofence) => void, failure?: (error:string) => void): Promise<Geofence>;
1334
+
1335
+ /**
1336
+ * Determine if a particular geofence exists in the SDK's database.
1337
+ *
1338
+ * @example
1339
+ * ```typescript
1340
+ * let exists = await BackgroundGeolocation.geofenceExists("HOME");
1341
+ * console.log("[geofenceExists] ", exists);
1342
+ * ```
1343
+ * ### ℹ️ See also:
1344
+ * - 📘 [[Geofence | Geofencing Guide]]
1345
+ */
1346
+ static geofenceExists(identifier:string, callback?:(exists:boolean) => void): Promise<boolean>;
1347
+
1348
+ /**
1349
+ * Sets the [[logLevel]].
1350
+ */
1351
+ static setLogLevel(value: LogLevel, success?:(state:State) => void, failure?:Function): Promise<State>;
1352
+
1353
+ /**
1354
+ * @deprecated Use [[Logger.getLog]].
1355
+ */
1356
+ static getLog(success?:(log:string) => void, failure?:(error:string) => void): Promise<string>;
1357
+
1358
+ /**
1359
+ * @deprecated Use [[Logger.emailLog]].
1360
+ */
1361
+ static emailLog(email:string, success?:Function, failure?:(error:string) => void): Promise<void>;
1362
+
1363
+ /**
1364
+ * @deprecated Use [[Logger.destroyLog]].
1365
+ */
1366
+ static destroyLog(success?:Function, failure?:Function): Promise<void>;
1367
+
1368
+ /**
1369
+ * Fetches the state of the operating-system's "Power Saving" mode.
1370
+ * @break
1371
+ *
1372
+ * Power Saving mode can throttle certain services in the background, such as HTTP requests or GPS.
1373
+ *
1374
+ * ℹ️ You can listen to changes in the state of "Power Saving" mode from the event [[onPowerSaveChange]].
1375
+ *
1376
+ * ### iOS
1377
+ *
1378
+ * iOS Power Saving mode can be engaged manually by the user in **Settings -> Battery** or from an automatic OS dialog.
1379
+ *
1380
+ * ![](https://dl.dropboxusercontent.com/s/lz3zl2jg4nzstg3/Screenshot%202017-09-19%2010.34.21.png?dl=1)
1381
+ *
1382
+ * ### Android
1383
+ *
1384
+ * Android Power Saving mode can be engaged manually by the user in **Settings -> Battery -> Battery Saver** or automatically with a user-specified
1385
+ * "threshold" (eg: 15%).
1386
+ *
1387
+ * ![](https://dl.dropboxusercontent.com/s/raz8lagrqayowia/Screenshot%202017-09-19%2010.33.49.png?dl=1)
1388
+ *
1389
+ * @example
1390
+ * ```typescript
1391
+ * let isPowerSaveMode = await BackgroundGeolocation.isPowerSaveMode;
1392
+ * ```
1393
+ */
1394
+ static isPowerSaveMode(success?:(enabled:boolean) => void, failure?:Function): Promise<boolean>;
1395
+
1396
+ /**
1397
+ * Returns the presence of device sensors *accelerometer*, *gyroscope*, *magnetometer*
1398
+ * @break
1399
+ *
1400
+ * These core [[Sensors]] are used by the motion activity-recognition system -- when any of these sensors are missing from a device (particularly on cheap
1401
+ * Android devices), the performance of the motion activity-recognition system will be **severely** degraded and highly inaccurate.
1402
+ *
1403
+ * For devices which *are* missing any of these sensors, you can increase the motion-detection sensitivity by decreasing
1404
+ * [[minimumActivityRecognitionConfidence]].
1405
+ *
1406
+ * @example
1407
+ * ```typescript
1408
+ * let sensors = await BackgroundGeolocation.sensors;
1409
+ * console.log(sensors);
1410
+ * ```
1411
+ */
1412
+ static getSensors(success?:(sensors:Sensors) => void, failure?:Function): Promise<Sensors>;
1413
+
1414
+ static getDeviceInfo(): Promise<DeviceInfo>;
1415
+
1416
+ /**
1417
+ * Retrieves the current state of location-provider authorization.
1418
+ *
1419
+ * ### ℹ️ See also:
1420
+ * - You can also *listen* for changes in location-authorization using the event [[onProviderChange]].
1421
+ *
1422
+ * @example
1423
+ * ```typescript
1424
+ * let providerState = await BackgroundGeolocation.getProviderState();
1425
+ * console.log("- Provider state: ", providerState);
1426
+ * ```
1427
+ */
1428
+ static getProviderState(success?:(state:ProviderChangeEvent) => void, failure?:Function): Promise<ProviderChangeEvent>;
1429
+
1430
+ /**
1431
+ * Manually request location permission from the user with the configured [[Config.locationAuthorizationRequest]].
1432
+ *
1433
+ * The method will resolve successful if *either* __`WhenInUse`__ or __`Always`__ is authorized, regardless of [[Config.locationAuthorizationRequest]]. Otherwise an error will be returned (eg: user denies location permission).
1434
+ *
1435
+ * If the user has already provided authorization for location-services, the method will resolve successfully immediately.
1436
+ *
1437
+ * If iOS has *already* presented the location authorization dialog and the user has not currently authorized your desired [[Config.locationAuthorizationRequest]], the SDK will present an error dialog offering to direct the user to your app's Settings screen.
1438
+ * - To disable this behaviour, see [[Config.disableLocationAuthorizationAlert]].
1439
+ * - To customize the text on this dialog, see [[Config.locationAuthorizationAlert]].
1440
+ *
1441
+ * ### ⚠️ Note:
1442
+ * - The SDK will **already request permission** from the user when you execute [[start]], [[startGeofences]], [[getCurrentPosition]], etc. You **do not need to explicitly execute this method** with typical use-cases.
1443
+ *
1444
+ * @example
1445
+ * ```typescript
1446
+ * async componentDidMount() {
1447
+ * // Listen to onProviderChange to be notified when location authorization changes occur.
1448
+ * BackgroundGeolocation.onProviderChange((event) => {
1449
+ * console.log('[providerchange]', event);
1450
+ * });
1451
+ *
1452
+ * // First ready the plugin with your configuration.
1453
+ * let state = await BackgroundGeolocation.ready({
1454
+ * locationAuthorizationRequest: 'Always'
1455
+ * });
1456
+ *
1457
+ * // Manually request permission with configured locationAuthorizationRequest.
1458
+ * try {
1459
+ * int status = await BackgroundGeolocation.requestPermission();
1460
+ * console.log('[requestPermission] success: ', status);
1461
+ * } catch(status) {
1462
+ * console.warn('[requestPermission] FAILURE: ', status);
1463
+ * }
1464
+ * }
1465
+ * ```
1466
+ *
1467
+ * ### ℹ️ See also:
1468
+ * - [[Config.locationAuthorizationRequest]]
1469
+ * - [[Config.disableLocationAuthorizationAlert]]
1470
+ * - [[Config.locationAuthorizationAlert]]
1471
+ * - [[Config.backgroundPermissionRationale]] (*Android 11+*)
1472
+ * - [[requestTemporaryFullAccuracy]] (*iOS 14+*)
1473
+ */
1474
+ static requestPermission(success?:(status:AuthorizationStatus) => void, failure?:(status:AuthorizationStatus) => void): Promise<AuthorizationStatus>;
1475
+
1476
+ /**
1477
+ * __`[iOS 14+]`__ iOS 14 has introduced a new __`[Precise: On]`__ switch on the location authorization dialog allowing users to disable high-accuracy location.
1478
+ *
1479
+ * The method [`requestTemporaryFullAccuracy` (Apple docs)](https://developer.apple.com/documentation/corelocation/cllocationmanager/3600217-requesttemporaryfullaccuracyauth?language=objc) will allow you to present a dialog to the user requesting temporary *full accuracy* for the lifetime of this application run (until terminate).
1480
+ *
1481
+ * ![](https://dl.dropbox.com/s/dj93xpg51vspqk0/ios-14-precise-on.png?dl=1)
1482
+ *
1483
+ * ## Configuration &mdash; `Info.plist`
1484
+ *
1485
+ * In order to use this method, you must configure your __`Info.plist`__ with the `Dictionary` key:
1486
+ * __`Privacy - Location Temporary Usage Description Dictionary`__
1487
+ *
1488
+ * ![](https://dl.dropbox.com/s/52f5lnjc4d9g8w7/ios-14-Privacy-Location-Temporary-Usage-Description-Dictionary.png?dl=1)
1489
+ *
1490
+ * The keys of this `Dictionary` (eg: `Delivery`) are supplied as the first argument to the method. The `value` will be printed on the dialog shown to the user, explaing the purpose of your request for full accuracy.
1491
+ *
1492
+ * If the dialog fails to be presented, an error will be thrown:
1493
+ * - The Info.plist file doesn’t have an entry for the given purposeKey value.
1494
+ * - The app is already authorized for full accuracy.
1495
+ * - The app is in the background.
1496
+ *
1497
+ * ![](https://dl.dropbox.com/s/8cc0sniv3pvpetl/ios-14-requestTemporaryFullAccuracy.png?dl=1)
1498
+ *
1499
+ * __Note:__ Android and older versions of iOS `< 14` will return [[BackgroundGeolocation.ACCURACY_AUTHORIZATION_FULL]].
1500
+ *
1501
+ * @example
1502
+ *
1503
+ * ```javascript
1504
+ * BackgroundGeolocation.onProviderChange((event) => {
1505
+ * if (event.accuracyAuthorization == BackgroundGeolocation.ACCURACY_AUTHORIZATION_REDUCED) {
1506
+ * // Supply "Purpose" key from Info.plist as 1st argument.
1507
+ * BackgroundGeolocation.requestTemporaryFullAccuracy("Delivery").then((accuracyAuthorization) => {
1508
+ * if (accuracyAuthorization == BackgroundGeolocation.ACCURACY_AUTHORIZATION_FULL) {
1509
+ * console.log('[requestTemporaryFullAccuracy] GRANTED: ', accuracyAuthorization);
1510
+ * } else {
1511
+ * console.log('[requestTemporaryFullAccuracy] DENIED: ', accuracyAuthorization);
1512
+ * }
1513
+ * }).catch((error) => {
1514
+ * console.warn("[requestTemporaryFullAccuracy] FAILED TO SHOW DIALOG: ", error);
1515
+ * });
1516
+ * }
1517
+ * });
1518
+ * ```
1519
+ *
1520
+ * __See also:__
1521
+ * - [[ProviderChangeEvent.accuracyAuthorization]].
1522
+ * - [What's new in iOS 14 `CoreLocation`](https://levelup.gitconnected.com/whats-new-with-corelocation-in-ios-14-bd28421c95c4)
1523
+ *
1524
+ */
1525
+ static requestTemporaryFullAccuracy(purpose:string):Promise<AccuracyAuthorization>;
1526
+
1527
+ /**
1528
+ *
1529
+ */
1530
+ static playSound(soundId:any, success?:Function, failure?:Function): Promise<void>;
1531
+
1532
+ /**
1533
+ * @deprecated Use [[Config.transistorAuthorizationToken]]
1534
+ */
1535
+ static transistorTrackerParams(device:Object):Object;
1536
+
1537
+ /**
1538
+ * Returns a *JSON Web Token* ([JWT](https://jwt.io/)) suitable for [[Authorization]] with the Transistor Software demo server at http://tracker.transistorsoft.com.
1539
+ *
1540
+ * To learn how to upload locations to the *Transistor Demo Server*, see [[TransistorAuthorizationToken]].
1541
+ * ![](https://dl.dropboxusercontent.com/s/3abuyyhioyypk8c/screenshot-tracker-transistorsoft.png?dl=1)
1542
+ *
1543
+ * This token is typically provided to [[Config.transistorAuthorizationToken]] when first configuring the SDK with [[ready]].
1544
+ *
1545
+ * ### Params
1546
+ *
1547
+ * #### `@param {String} orgname`
1548
+ *
1549
+ * Represents a "company" or "organization"; a container for posting locations from multiple devices to the same account. `orgname` is used for accessing your device results in web app, eg: http://tracker.transistorsoft.com/my-organization-name.
1550
+ *
1551
+ * #### `@param {String} username`
1552
+ *
1553
+ * Appended to the [[DeviceInfo.model]] as a means of creating a consistent and unique device identifier. For example:
1554
+ * - `Pixel 3a-my-username`
1555
+ * - `A310-my-username`
1556
+ * - `iPhone 11,3-my-username`
1557
+ *
1558
+ * #### `@param {String} url [http://tracker.transistorsoft.com]`
1559
+ *
1560
+ * The server to register with and receive authentication tokens from. Defaults to `http://tracker.transistorsoft.com`. If you have a local instance of [background-geolocation-console](https://github.com/transistorsoft/background-geolocation-console) running
1561
+ * on your localhost, you would provide the __ip address__ of your server, eg: `http://192.168.0.100:9000`.
1562
+ *
1563
+ * --------------------------------------------------
1564
+ *
1565
+ *
1566
+ * When the SDK receives the [[TransistorAuthorizationToken]] from `url`, it will be cached in persistant-storage within the native code. If the SDK doesn"t find a cached token on the client, it will automatically register for one from `url`, using the provided `orgname` and `username`. Otherwise, the cached token will be immediately returned.
1567
+ *
1568
+ *
1569
+ * @example
1570
+ * ```typescript
1571
+ * let orgname = "my-company-name";
1572
+ * let username = "my-username";
1573
+ *
1574
+ * let token = await BackgroundGeolocation.findOrCreateTransistorAuthorizationToken(orgname, username);
1575
+ *
1576
+ * BackgroundGeolocation.ready({
1577
+ * transistorAuthorizationToken: token
1578
+ * });
1579
+ * ```
1580
+ *
1581
+ * ### ℹ️ See also:
1582
+ * - [[destroyTransistorAuthorizationToken]]
1583
+ * - [[Config.transistorAuthorizationToken]]
1584
+ */
1585
+ static findOrCreateTransistorAuthorizationToken(orgname:string, username:string, url?:string): Promise<TransistorAuthorizationToken>;
1586
+
1587
+ /**
1588
+ * Destroys the cached Transistor JSON Web Token used to authorize with the Demo Server at http://tracker.transistorsoft.com or your local instance of [background-geolocation-console](https://github.com/transistorsoft/background-geolocation-console)
1589
+ *
1590
+ * @example
1591
+ * ```typescript
1592
+ * await BackgroundGeolocation.destroyTransistorAuthorizationToken();
1593
+ * ```
1594
+ *
1595
+ * ### ℹ️ See also:
1596
+ * - [[findOrCreateTransistorAuthorizationToken]]
1597
+ */
1598
+ static destroyTransistorAuthorizationToken(url?:string): Promise<boolean>;
1599
+ }
1600
+ export default BackgroundGeolocation;
1601
+ }