expo-location 56.0.8 → 56.0.10

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 (82) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/location/LocationExceptions.kt +18 -0
  4. package/android/src/main/java/expo/modules/location/LocationModule.kt +233 -1
  5. package/android/src/main/java/expo/modules/location/records/LocationArguments.kt +15 -0
  6. package/android/src/main/java/expo/modules/location/records/LocationResults.kt +23 -1
  7. package/build/ExpoLocation.web.d.ts +3 -0
  8. package/build/ExpoLocation.web.d.ts.map +1 -1
  9. package/build/ExpoLocation.web.js +19 -0
  10. package/build/ExpoLocation.web.js.map +1 -1
  11. package/build/Location.d.ts +68 -1
  12. package/build/Location.d.ts.map +1 -1
  13. package/build/Location.js +105 -1
  14. package/build/Location.js.map +1 -1
  15. package/build/Location.types.d.ts +95 -0
  16. package/build/Location.types.d.ts.map +1 -1
  17. package/build/Location.types.js +53 -0
  18. package/build/Location.types.js.map +1 -1
  19. package/build/LocationSubscribers.d.ts +8 -2
  20. package/build/LocationSubscribers.d.ts.map +1 -1
  21. package/build/LocationSubscribers.js +15 -0
  22. package/build/LocationSubscribers.js.map +1 -1
  23. package/expo-module.config.json +1 -1
  24. package/ios/LocationExceptions.swift +15 -0
  25. package/ios/LocationModule.swift +64 -2
  26. package/ios/Providers/MotionActivityStreamer.swift +49 -0
  27. package/ios/Requesters/MotionActivityPermissionRequester.swift +47 -0
  28. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10-sources.jar +0 -0
  29. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10-sources.jar.md5 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10-sources.jar.sha1 +1 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10-sources.jar.sha256 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10-sources.jar.sha512 +1 -0
  33. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.aar +0 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.aar.md5 +1 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.aar.sha1 +1 -0
  36. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.aar.sha256 +1 -0
  37. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.aar.sha512 +1 -0
  38. package/local-maven-repo/host/exp/exponent/expo.modules.location/{56.0.8/expo.modules.location-56.0.8.module → 56.0.10/expo.modules.location-56.0.10.module} +22 -22
  39. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.module.md5 +1 -0
  40. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.module.sha1 +1 -0
  41. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.module.sha256 +1 -0
  42. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.module.sha512 +1 -0
  43. package/local-maven-repo/host/exp/exponent/expo.modules.location/{56.0.8/expo.modules.location-56.0.8.pom → 56.0.10/expo.modules.location-56.0.10.pom} +1 -1
  44. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.pom.md5 +1 -0
  45. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.pom.sha1 +1 -0
  46. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.pom.sha256 +1 -0
  47. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.10/expo.modules.location-56.0.10.pom.sha512 +1 -0
  48. package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml +4 -4
  49. package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.md5 +1 -1
  50. package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.sha1 +1 -1
  51. package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.sha256 +1 -1
  52. package/local-maven-repo/host/exp/exponent/expo.modules.location/maven-metadata.xml.sha512 +1 -1
  53. package/mocks/ExpoLocation.ts +6 -0
  54. package/package.json +5 -5
  55. package/plugin/build/withLocation.d.ts +17 -0
  56. package/plugin/build/withLocation.js +6 -1
  57. package/plugin/src/withLocation.ts +24 -0
  58. package/plugin/tsconfig.tsbuildinfo +1 -0
  59. package/prebuilds/output/debug/xcframeworks/ExpoLocation.tar.gz +0 -0
  60. package/prebuilds/output/release/xcframeworks/ExpoLocation.tar.gz +0 -0
  61. package/src/ExpoLocation.web.ts +22 -0
  62. package/src/Location.ts +120 -0
  63. package/src/Location.types.ts +100 -0
  64. package/src/LocationSubscribers.ts +28 -1
  65. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8-sources.jar +0 -0
  66. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8-sources.jar.md5 +0 -1
  67. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8-sources.jar.sha1 +0 -1
  68. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8-sources.jar.sha256 +0 -1
  69. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8-sources.jar.sha512 +0 -1
  70. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.aar +0 -0
  71. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.aar.md5 +0 -1
  72. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.aar.sha1 +0 -1
  73. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.aar.sha256 +0 -1
  74. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.aar.sha512 +0 -1
  75. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.module.md5 +0 -1
  76. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.module.sha1 +0 -1
  77. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.module.sha256 +0 -1
  78. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.module.sha512 +0 -1
  79. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.pom.md5 +0 -1
  80. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.pom.sha1 +0 -1
  81. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.pom.sha256 +0 -1
  82. package/local-maven-repo/host/exp/exponent/expo.modules.location/56.0.8/expo.modules.location-56.0.8.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,14 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 56.0.10 — 2026-05-19
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 56.0.9 — 2026-05-15
18
+
19
+ _This version does not introduce any user-facing changes._
20
+
13
21
  ## 56.0.8 — 2026-05-13
14
22
 
15
23
  _This version does not introduce any user-facing changes._
@@ -53,6 +61,7 @@ _This version does not introduce any user-facing changes._
53
61
  ### 🎉 New features
54
62
 
55
63
  - Expose a typed config plugin function ([#44098](https://github.com/expo/expo/pull/44098) by [@zoontek](https://github.com/zoontek))
64
+ - Added motion activity APIs: `getMotionActivityAsync`, `watchMotionActivityAsync`, and permission helpers. ([#44893](https://github.com/expo/expo/pull/44893) by [@Guccio163](https://github.com/Guccio163))
56
65
 
57
66
  ### 🐛 Bug fixes
58
67
 
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '56.0.8'
7
+ version = '56.0.10'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.location"
11
11
  defaultConfig {
12
12
  versionCode 29
13
- versionName "56.0.8"
13
+ versionName "56.0.10"
14
14
  consumerProguardFiles("proguard-rules.pro")
15
15
  }
16
16
  }
@@ -58,3 +58,21 @@ internal class ForegroundServiceStartNotAllowedException :
58
58
 
59
59
  internal class ForegroundServicePermissionsException :
60
60
  CodedException("Couldn't start the foreground service. Foreground service permissions were not found in the manifest")
61
+
62
+ internal class MotionActivityUnauthorizedException :
63
+ CodedException(
64
+ """
65
+ Activity recognition permission is required.
66
+ On Android 10 and above, add android.permission.ACTIVITY_RECOGNITION to your AndroidManifest.xml
67
+ and request it at runtime before calling this method
68
+ """.trimIndent()
69
+ )
70
+
71
+ internal class MotionActivityUnavailableException(cause: Throwable? = null) :
72
+ CodedException(
73
+ message = """
74
+ Activity recognition is not available on this device.
75
+ Make sure Google Play Services is installed and up to date.
76
+ """.trimIndent(),
77
+ cause = cause
78
+ )
@@ -2,8 +2,11 @@ package expo.modules.location
2
2
 
3
3
  import android.Manifest
4
4
  import android.app.Activity
5
+ import android.app.PendingIntent
6
+ import android.content.BroadcastReceiver
5
7
  import android.content.Context
6
8
  import android.content.Intent
9
+ import android.content.IntentFilter
7
10
  import android.content.pm.PackageManager
8
11
  import android.hardware.GeomagneticField
9
12
  import android.hardware.Sensor
@@ -23,6 +26,9 @@ import androidx.core.os.bundleOf
23
26
  import com.google.android.gms.common.api.ApiException
24
27
  import com.google.android.gms.common.api.CommonStatusCodes
25
28
  import com.google.android.gms.common.api.ResolvableApiException
29
+ import com.google.android.gms.location.ActivityRecognition
30
+ import com.google.android.gms.location.ActivityRecognitionResult
31
+ import com.google.android.gms.location.DetectedActivity
26
32
  import com.google.android.gms.location.FusedLocationProviderClient
27
33
  import com.google.android.gms.location.LocationAvailability
28
34
  import com.google.android.gms.location.LocationCallback
@@ -48,6 +54,11 @@ import expo.modules.location.records.LocationOptions
48
54
  import expo.modules.location.records.LocationProviderStatus
49
55
  import expo.modules.location.records.LocationResponse
50
56
  import expo.modules.location.records.LocationTaskOptions
57
+ import expo.modules.location.records.MotionActivitiesRecord
58
+ import expo.modules.location.records.MotionActivityConfidence
59
+ import expo.modules.location.records.MotionActivityObjectRecord
60
+ import expo.modules.location.records.MotionActivityStateRecord
61
+ import expo.modules.location.records.MotionActivityType
51
62
  import expo.modules.location.records.PermissionDetailsLocationAndroid
52
63
  import expo.modules.location.records.PermissionRequestResponse
53
64
  import expo.modules.location.records.ReverseGeocodeLocation
@@ -78,6 +89,37 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
78
89
  private var mLastUpdate: Long = 0
79
90
  private var mGeocoderPaused = false
80
91
 
92
+ // Motion activity
93
+ private val mMotionActivityWatchIds = mutableSetOf<Int>()
94
+ private var mMotionActivityPendingIntent: PendingIntent? = null
95
+ private var mMotionActivityReceiverRegistered = false
96
+ private val mMotionActivityReceiver = object : BroadcastReceiver() {
97
+ override fun onReceive(context: Context, intent: Intent) {
98
+ val result = ActivityRecognitionResult.extractResult(intent) ?: return
99
+
100
+ // When multiple Android types map to the same unified type
101
+ // (e.g. WALKING + ON_FOOT -> walking), take the highest confidence.
102
+ val confidenceByType = result.probableActivities
103
+ .groupBy { it.toMotionActivityType() }
104
+ .mapValues { (_, activities) -> activities.maxOf { it.confidence } }
105
+
106
+ val activity = MotionActivityObjectRecord(
107
+ activities = MotionActivitiesRecord(
108
+ automotive = confidenceByType.stateFor(MotionActivityType.AUTOMOTIVE),
109
+ cycling = confidenceByType.stateFor(MotionActivityType.CYCLING),
110
+ running = confidenceByType.stateFor(MotionActivityType.RUNNING),
111
+ walking = confidenceByType.stateFor(MotionActivityType.WALKING),
112
+ stationary = confidenceByType.stateFor(MotionActivityType.STATIONARY),
113
+ unknown = confidenceByType.stateFor(MotionActivityType.UNKNOWN)
114
+ ),
115
+ timestamp = System.currentTimeMillis().toDouble()
116
+ )
117
+ for (id in mMotionActivityWatchIds) {
118
+ sendEvent(MOTION_ACTIVITY_EVENT_NAME, mapOf("watchId" to id, "activity" to activity))
119
+ }
120
+ }
121
+ }
122
+
81
123
  private val mTaskManager: TaskManagerInterface by lazy {
82
124
  return@lazy appContext.legacyModule<TaskManagerInterface>()
83
125
  ?: throw TaskManagerNotFoundException()
@@ -94,7 +136,7 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
94
136
  ?: throw SensorManagerUnavailable()
95
137
  }
96
138
 
97
- Events(HEADING_EVENT_NAME, LOCATION_EVENT_NAME)
139
+ Events(HEADING_EVENT_NAME, LOCATION_EVENT_NAME, MOTION_ACTIVITY_EVENT_NAME)
98
140
 
99
141
  // Deprecated
100
142
  AsyncFunction("requestPermissionsAsync") Coroutine { ->
@@ -152,6 +194,14 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
152
194
  return@Coroutine getBackgroundPermissionsAsync()
153
195
  }
154
196
 
197
+ AsyncFunction("getMotionActivityPermissionsAsync") Coroutine { ->
198
+ return@Coroutine getMotionActivityPermissionsAsync()
199
+ }
200
+
201
+ AsyncFunction("requestMotionActivityPermissionsAsync") Coroutine { ->
202
+ return@Coroutine requestMotionActivityPermissionsAsync()
203
+ }
204
+
155
205
  AsyncFunction("getLastKnownPositionAsync") Coroutine { options: LocationLastKnownOptions ->
156
206
  return@Coroutine getLastKnownPositionAsync(options)
157
207
  }
@@ -198,7 +248,23 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
198
248
  }
199
249
  }
200
250
 
251
+ AsyncFunction("watchMotionActivityImplAsync") Coroutine { watchId: Int ->
252
+ if (isMissingActivityRecognitionPermission()) {
253
+ throw MotionActivityUnauthorizedException()
254
+ }
255
+ startMotionActivityWatch(watchId)
256
+ }
257
+
201
258
  AsyncFunction("removeWatchAsync") { watchId: Int ->
259
+ // Motion activity does not require location permissions - check it first.
260
+ if (mMotionActivityWatchIds.contains(watchId)) {
261
+ mMotionActivityWatchIds.remove(watchId)
262
+ if (mMotionActivityWatchIds.isEmpty()) {
263
+ stopMotionActivityWatch()
264
+ }
265
+ return@AsyncFunction
266
+ }
267
+
202
268
  if (isMissingForegroundPermissions()) {
203
269
  throw LocationUnauthorizedException()
204
270
  }
@@ -744,6 +810,165 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
744
810
  }
745
811
  }
746
812
 
813
+ // region motion activity
814
+
815
+ private suspend fun startMotionActivityWatch(watchId: Int) {
816
+ val alreadyRunning = mMotionActivityWatchIds.isNotEmpty()
817
+ mMotionActivityWatchIds.add(watchId)
818
+ if (alreadyRunning) {
819
+ return
820
+ }
821
+ registerMotionActivityReceiver()
822
+ val pendingIntent = getOrCreateMotionActivityPendingIntent()
823
+ suspendCoroutine { continuation ->
824
+ ActivityRecognition.getClient(mContext)
825
+ .requestActivityUpdates(MOTION_ACTIVITY_INTERVAL_MS, pendingIntent)
826
+ .addOnSuccessListener { continuation.resume(Unit) }
827
+ .addOnFailureListener { e ->
828
+ mMotionActivityWatchIds.remove(watchId)
829
+ if (mMotionActivityWatchIds.isEmpty()) {
830
+ stopMotionActivityWatch()
831
+ }
832
+ continuation.resumeWithException(MotionActivityUnavailableException(e))
833
+ }
834
+ }
835
+ }
836
+
837
+ private fun stopMotionActivityWatch() {
838
+ val pendingIntent = mMotionActivityPendingIntent ?: return
839
+ ActivityRecognition.getClient(mContext)
840
+ .removeActivityUpdates(pendingIntent)
841
+ .addOnFailureListener { e ->
842
+ Log.e(TAG, "Failed to remove activity updates: ${e.message}")
843
+ }
844
+ unregisterMotionActivityReceiver()
845
+ mMotionActivityPendingIntent = null
846
+ mMotionActivityWatchIds.clear()
847
+ }
848
+
849
+ private fun pauseMotionActivityWatch() {
850
+ if (mMotionActivityWatchIds.isEmpty()) {
851
+ return
852
+ }
853
+ val pendingIntent = mMotionActivityPendingIntent ?: return
854
+ ActivityRecognition.getClient(mContext)
855
+ .removeActivityUpdates(pendingIntent)
856
+ .addOnFailureListener { e ->
857
+ Log.w(TAG, "Failed to pause activity updates: ${e.message}")
858
+ }
859
+ unregisterMotionActivityReceiver()
860
+ }
861
+
862
+ private fun resumeMotionActivityWatch() {
863
+ if (mMotionActivityWatchIds.isEmpty()) {
864
+ return
865
+ }
866
+ registerMotionActivityReceiver()
867
+ val pendingIntent = getOrCreateMotionActivityPendingIntent()
868
+ ActivityRecognition.getClient(mContext)
869
+ .requestActivityUpdates(MOTION_ACTIVITY_INTERVAL_MS, pendingIntent)
870
+ .addOnFailureListener { e ->
871
+ Log.w(TAG, "Failed to resume activity updates: ${e.message}")
872
+ }
873
+ }
874
+
875
+ private fun registerMotionActivityReceiver() {
876
+ if (mMotionActivityReceiverRegistered) {
877
+ return
878
+ }
879
+ val filter = IntentFilter(MOTION_ACTIVITY_INTENT_ACTION)
880
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
881
+ mContext.registerReceiver(mMotionActivityReceiver, filter, Context.RECEIVER_NOT_EXPORTED)
882
+ } else {
883
+ mContext.registerReceiver(mMotionActivityReceiver, filter)
884
+ }
885
+ mMotionActivityReceiverRegistered = true
886
+ }
887
+
888
+ private fun unregisterMotionActivityReceiver() {
889
+ if (!mMotionActivityReceiverRegistered) {
890
+ return
891
+ }
892
+ try {
893
+ mContext.unregisterReceiver(mMotionActivityReceiver)
894
+ } catch (e: IllegalArgumentException) {
895
+ Log.w(TAG, "Motion activity receiver was already unregistered: ${e.message}")
896
+ }
897
+ mMotionActivityReceiverRegistered = false
898
+ }
899
+
900
+ private fun getOrCreateMotionActivityPendingIntent(): PendingIntent {
901
+ return mMotionActivityPendingIntent ?: PendingIntent.getBroadcast(
902
+ mContext,
903
+ MOTION_ACTIVITY_REQUEST_CODE,
904
+ Intent(MOTION_ACTIVITY_INTENT_ACTION).apply { setPackage(mContext.packageName) },
905
+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
906
+ ).also { mMotionActivityPendingIntent = it }
907
+ }
908
+
909
+ private suspend fun getMotionActivityPermissionsAsync(): PermissionRequestResponse {
910
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
911
+ return PermissionRequestResponse(
912
+ canAskAgain = true,
913
+ expires = "never",
914
+ granted = true,
915
+ status = "granted",
916
+ android = null
917
+ )
918
+ }
919
+ appContext.permissions?.let {
920
+ return LocationHelpers.getPermissionsWithPermissionsManager(it, Manifest.permission.ACTIVITY_RECOGNITION)
921
+ } ?: throw NoPermissionsModuleException()
922
+ }
923
+
924
+ private suspend fun requestMotionActivityPermissionsAsync(): PermissionRequestResponse {
925
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
926
+ return PermissionRequestResponse(
927
+ canAskAgain = true,
928
+ expires = "never",
929
+ granted = true,
930
+ status = "granted",
931
+ android = null
932
+ )
933
+ }
934
+ appContext.permissions?.let {
935
+ val bundle = LocationHelpers.askForPermissionsWithPermissionsManager(it, Manifest.permission.ACTIVITY_RECOGNITION)
936
+ return PermissionRequestResponse(bundle)
937
+ } ?: throw NoPermissionsModuleException()
938
+ }
939
+
940
+ private fun isMissingActivityRecognitionPermission(): Boolean {
941
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
942
+ return appContext.permissions?.let {
943
+ !it.hasGrantedPermissions(Manifest.permission.ACTIVITY_RECOGNITION)
944
+ } ?: true
945
+ }
946
+ return false
947
+ }
948
+
949
+ private fun DetectedActivity.toMotionActivityType(): MotionActivityType = when (type) {
950
+ DetectedActivity.IN_VEHICLE -> MotionActivityType.AUTOMOTIVE
951
+ DetectedActivity.ON_BICYCLE -> MotionActivityType.CYCLING
952
+ DetectedActivity.RUNNING -> MotionActivityType.RUNNING
953
+ DetectedActivity.WALKING, DetectedActivity.ON_FOOT -> MotionActivityType.WALKING
954
+ DetectedActivity.STILL -> MotionActivityType.STATIONARY
955
+ else -> MotionActivityType.UNKNOWN
956
+ }
957
+
958
+ private fun Map<MotionActivityType, Int>.stateFor(type: MotionActivityType): MotionActivityStateRecord {
959
+ val raw = getOrDefault(type, 0)
960
+ return MotionActivityStateRecord(
961
+ detected = raw >= 50,
962
+ confidence = when {
963
+ raw >= 75 -> MotionActivityConfidence.HIGH
964
+ raw >= 50 -> MotionActivityConfidence.MEDIUM
965
+ else -> MotionActivityConfidence.LOW
966
+ }
967
+ )
968
+ }
969
+
970
+ // endregion
971
+
747
972
  //region private methods
748
973
  /**
749
974
  * Checks whether all required permissions have been granted by the user.
@@ -809,6 +1034,10 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
809
1034
  internal val TAG = LocationModule::class.java.simpleName
810
1035
  private const val LOCATION_EVENT_NAME = "Expo.locationChanged"
811
1036
  private const val HEADING_EVENT_NAME = "Expo.headingChanged"
1037
+ private const val MOTION_ACTIVITY_EVENT_NAME = "Expo.motionActivityChanged"
1038
+ private const val MOTION_ACTIVITY_INTENT_ACTION = "expo.modules.location.MOTION_ACTIVITY_UPDATE"
1039
+ private const val MOTION_ACTIVITY_REQUEST_CODE = 43
1040
+ private const val MOTION_ACTIVITY_INTERVAL_MS = 0L
812
1041
  private const val CHECK_SETTINGS_REQUEST_CODE = 42
813
1042
 
814
1043
  const val ACCURACY_LOWEST = 1
@@ -828,16 +1057,19 @@ class LocationModule : Module(), LifecycleEventListener, SensorEventListener, Ac
828
1057
  override fun onHostResume() {
829
1058
  startWatching()
830
1059
  startHeadingUpdate()
1060
+ resumeMotionActivityWatch()
831
1061
  }
832
1062
 
833
1063
  override fun onHostPause() {
834
1064
  stopWatching()
835
1065
  stopHeadingWatch()
1066
+ pauseMotionActivityWatch()
836
1067
  }
837
1068
 
838
1069
  override fun onHostDestroy() {
839
1070
  stopWatching()
840
1071
  stopHeadingWatch()
1072
+ stopMotionActivityWatch()
841
1073
  }
842
1074
 
843
1075
  override fun onSensorChanged(event: SensorEvent?) {
@@ -14,6 +14,21 @@ enum class GeofencingRegionState : Enumerable {
14
14
  OUTSIDE
15
15
  }
16
16
 
17
+ enum class MotionActivityType(val value: String) : Enumerable {
18
+ AUTOMOTIVE("automotive"),
19
+ CYCLING("cycling"),
20
+ RUNNING("running"),
21
+ WALKING("walking"),
22
+ STATIONARY("stationary"),
23
+ UNKNOWN("unknown")
24
+ }
25
+
26
+ enum class MotionActivityConfidence(val value: Int) : Enumerable {
27
+ LOW(0),
28
+ MEDIUM(1),
29
+ HIGH(2)
30
+ }
31
+
17
32
  @OptimizedRecord
18
33
  internal class LocationLastKnownOptions(
19
34
  @Field var maxAge: Double? = null,
@@ -9,10 +9,32 @@ import android.os.PersistableBundle
9
9
  import android.util.Log
10
10
  import expo.modules.kotlin.records.Field
11
11
  import expo.modules.kotlin.records.Record
12
+ import expo.modules.kotlin.types.OptimizedRecord
12
13
  import expo.modules.location.ConversionException
13
14
  import expo.modules.location.LocationModule
14
15
  import java.io.Serializable
15
- import expo.modules.kotlin.types.OptimizedRecord
16
+
17
+ @OptimizedRecord
18
+ internal class MotionActivityStateRecord(
19
+ @Field var detected: Boolean,
20
+ @Field var confidence: MotionActivityConfidence
21
+ ) : Record, Serializable
22
+
23
+ @OptimizedRecord
24
+ internal class MotionActivitiesRecord(
25
+ @Field var automotive: MotionActivityStateRecord,
26
+ @Field var cycling: MotionActivityStateRecord,
27
+ @Field var running: MotionActivityStateRecord,
28
+ @Field var walking: MotionActivityStateRecord,
29
+ @Field var stationary: MotionActivityStateRecord,
30
+ @Field var unknown: MotionActivityStateRecord
31
+ ) : Record, Serializable
32
+
33
+ @OptimizedRecord
34
+ internal class MotionActivityObjectRecord(
35
+ @Field var activities: MotionActivitiesRecord,
36
+ @Field var timestamp: Double
37
+ ) : Record, Serializable
16
38
 
17
39
  @OptimizedRecord
18
40
  internal class PermissionRequestResponse(
@@ -12,6 +12,9 @@ declare const _default: {
12
12
  geocodeAsync(): Promise<any[]>;
13
13
  reverseGeocodeAsync(): Promise<any[]>;
14
14
  watchPositionImplAsync(watchId: number, options: PositionOptions): Promise<number>;
15
+ watchMotionActivityImplAsync(_watchId: number): Promise<void>;
16
+ getMotionActivityPermissionsAsync(): Promise<PermissionResponse>;
17
+ requestMotionActivityPermissionsAsync(): Promise<PermissionResponse>;
15
18
  requestForegroundPermissionsAsync(): Promise<PermissionResponse>;
16
19
  requestBackgroundPermissionsAsync(): Promise<PermissionResponse>;
17
20
  getForegroundPermissionsAsync(): Promise<PermissionResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoLocation.web.d.ts","sourceRoot":"","sources":["../src/ExpoLocation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,MAAM,CAAC;AAGjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;;8BAwHhE,OAAO,CAAC;QAAE,uBAAuB,EAAE,OAAO,CAAA;KAAE,CAAC;wCAMlE,wBAAwB,GAChC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;qCAMM,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;8BAahD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;mCAGjB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;+BAG1B,OAAO,CAAC,OAAO,CAAC;oBAG3B,OAAO,CAAC,GAAG,EAAE,CAAC;2BAGP,OAAO,CAAC,GAAG,EAAE,CAAC;oCAGL,MAAM,WAAW,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;yCAiB7C,OAAO,CAAC,kBAAkB,CAAC;yCAG3B,OAAO,CAAC,kBAAkB,CAAC;qCAG/B,OAAO,CAAC,kBAAkB,CAAC;qCAG3B,OAAO,CAAC,kBAAkB,CAAC;;AApEpE,wBAuEE"}
1
+ {"version":3,"file":"ExpoLocation.web.d.ts","sourceRoot":"","sources":["../src/ExpoLocation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,MAAM,CAAC;AAGjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;;8BAwHhE,OAAO,CAAC;QAAE,uBAAuB,EAAE,OAAO,CAAA;KAAE,CAAC;wCAMlE,wBAAwB,GAChC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;qCAMM,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;8BAahD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;mCAGjB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;+BAG1B,OAAO,CAAC,OAAO,CAAC;oBAG3B,OAAO,CAAC,GAAG,EAAE,CAAC;2BAGP,OAAO,CAAC,GAAG,EAAE,CAAC;oCAGL,MAAM,WAAW,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;2CAiB3C,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;yCAIxB,OAAO,CAAC,kBAAkB,CAAC;6CASvB,OAAO,CAAC,kBAAkB,CAAC;yCAS/B,OAAO,CAAC,kBAAkB,CAAC;yCAG3B,OAAO,CAAC,kBAAkB,CAAC;qCAG/B,OAAO,CAAC,kBAAkB,CAAC;qCAG3B,OAAO,CAAC,kBAAkB,CAAC;;AA1FpE,wBA6FE"}
@@ -152,6 +152,25 @@ export default {
152
152
  resolve(watchId);
153
153
  });
154
154
  },
155
+ async watchMotionActivityImplAsync(_watchId) {
156
+ console.warn('Location.watchMotionActivityAsync: is not supported on web');
157
+ },
158
+ async getMotionActivityPermissionsAsync() {
159
+ return {
160
+ status: PermissionStatus.UNDETERMINED,
161
+ granted: false,
162
+ canAskAgain: false,
163
+ expires: 'never',
164
+ };
165
+ },
166
+ async requestMotionActivityPermissionsAsync() {
167
+ return {
168
+ status: PermissionStatus.UNDETERMINED,
169
+ granted: false,
170
+ canAskAgain: false,
171
+ expires: 'never',
172
+ };
173
+ },
155
174
  async requestForegroundPermissionsAsync() {
156
175
  return getPermissionsAsync(true);
157
176
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoLocation.web.js","sourceRoot":"","sources":["../src/ExpoLocation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,aAAc,SAAQ,KAAK;IAC/B,IAAI,CAAS;IAEb;QACE,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED;;GAEG;AACH,SAAS,yBAAyB,CAAC,QAAwB;IACzD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;IACvC,OAAO;QACL,MAAM,EAAE;YACN,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB;QACD,SAAS;KACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,QAAwB,EAAE,OAAiC;IAClF,MAAM,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9E,MAA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ACF,OAAO,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iCAAiC;QACrC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,iCAAiC;QACrC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,6BAA6B;QACjC,OAAO,mBAAmB,EAAE,CAAC;IAC/B,CAAC;IACD,KAAK,CAAC,6BAA6B;QACjC,OAAO,mBAAmB,EAAE,CAAC;IAC/B,CAAC;CACF,CAAC","sourcesContent":["import { type PermissionResponse, PermissionStatus } from 'expo';\nimport { UnavailabilityError } from 'expo-modules-core';\n\nimport type { LocationLastKnownOptions, LocationObject, LocationOptions } from './Location.types';\nimport { LocationAccuracy } from './Location.types';\nimport { LocationEventEmitter } from './LocationEventEmitter';\n\nclass GeocoderError extends Error {\n code: string;\n\n constructor() {\n super('Geocoder service is not available for this device.');\n this.code = 'E_NO_GEOCODER';\n }\n}\n\n/**\n * Converts `GeolocationPosition` to JavaScript object.\n */\nfunction geolocationPositionToJSON(position: LocationObject): LocationObject {\n const { coords, timestamp } = position;\n return {\n coords: {\n latitude: coords.latitude,\n longitude: coords.longitude,\n altitude: coords.altitude,\n accuracy: coords.accuracy,\n altitudeAccuracy: coords.altitudeAccuracy,\n heading: coords.heading,\n speed: coords.speed,\n },\n timestamp,\n };\n}\n\n/**\n * Checks whether given location didn't exceed given `maxAge` and fits in the required accuracy.\n */\nfunction isLocationValid(location: LocationObject, options: LocationLastKnownOptions): boolean {\n const maxAge = typeof options.maxAge === 'number' ? options.maxAge : Infinity;\n const requiredAccuracy =\n typeof options.requiredAccuracy === 'number' ? options.requiredAccuracy : Infinity;\n const locationAccuracy = location.coords.accuracy ?? Infinity;\n\n return Date.now() - location.timestamp <= maxAge && locationAccuracy <= requiredAccuracy;\n}\n\n/**\n * Gets the permission details. The implementation is not very good as it's not\n * possible to query for permission on all browsers, apparently only the\n * latest versions will support this.\n */\nasync function getPermissionsAsync(shouldAsk = false): Promise<PermissionResponse> {\n if (!navigator?.permissions?.query) {\n throw new UnavailabilityError('expo-location', 'navigator.permissions API is not available');\n }\n\n const permission = await navigator.permissions.query({ name: 'geolocation' });\n\n if (permission.state === 'granted') {\n return {\n status: PermissionStatus.GRANTED,\n granted: true,\n canAskAgain: true,\n expires: 0,\n };\n }\n\n if (permission.state === 'denied') {\n return {\n status: PermissionStatus.DENIED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n };\n }\n\n if (shouldAsk) {\n return new Promise((resolve) => {\n navigator.geolocation.getCurrentPosition(\n () => {\n resolve({\n status: PermissionStatus.GRANTED,\n granted: true,\n canAskAgain: true,\n expires: 0,\n });\n },\n (positionError: GeolocationPositionError) => {\n if (positionError.code === positionError.PERMISSION_DENIED) {\n resolve({\n status: PermissionStatus.DENIED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n });\n return;\n }\n\n resolve({\n status: PermissionStatus.GRANTED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n });\n }\n );\n });\n }\n\n // The permission state is 'prompt' when the permission has not been requested\n // yet, tested on Chrome.\n return {\n status: PermissionStatus.UNDETERMINED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n };\n}\n\nlet lastKnownPosition: LocationObject | null = null;\n\nexport default {\n async getProviderStatusAsync(): Promise<{ locationServicesEnabled: boolean }> {\n return {\n locationServicesEnabled: 'geolocation' in navigator,\n };\n },\n async getLastKnownPositionAsync(\n options: LocationLastKnownOptions = {}\n ): Promise<LocationObject | null> {\n if (lastKnownPosition && isLocationValid(lastKnownPosition, options)) {\n return lastKnownPosition;\n }\n return null;\n },\n async getCurrentPositionAsync(options: LocationOptions): Promise<LocationObject> {\n return new Promise<LocationObject>((resolve, reject) => {\n const resolver: PositionCallback = (position) => {\n lastKnownPosition = geolocationPositionToJSON(position);\n resolve(lastKnownPosition);\n };\n navigator.geolocation.getCurrentPosition(resolver, reject, {\n maximumAge: Infinity,\n enableHighAccuracy: (options.accuracy ?? 0) > LocationAccuracy.Balanced,\n ...options,\n });\n });\n },\n async removeWatchAsync(watchId: number): Promise<void> {\n navigator.geolocation.clearWatch(watchId);\n },\n async watchDeviceHeading(_headingId: number): Promise<void> {\n console.warn('Location.watchDeviceHeading: is not supported on web');\n },\n async hasServicesEnabledAsync(): Promise<boolean> {\n return 'geolocation' in navigator;\n },\n async geocodeAsync(): Promise<any[]> {\n throw new GeocoderError();\n },\n async reverseGeocodeAsync(): Promise<any[]> {\n throw new GeocoderError();\n },\n async watchPositionImplAsync(watchId: number, options: PositionOptions): Promise<number> {\n return new Promise((resolve) => {\n watchId = navigator.geolocation.watchPosition(\n (position) => {\n lastKnownPosition = geolocationPositionToJSON(position);\n LocationEventEmitter.emit('Expo.locationChanged', {\n watchId,\n location: lastKnownPosition,\n });\n },\n undefined,\n options\n );\n resolve(watchId);\n });\n },\n\n async requestForegroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync(true);\n },\n async requestBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync(true);\n },\n async getForegroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync();\n },\n async getBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync();\n },\n};\n"]}
1
+ {"version":3,"file":"ExpoLocation.web.js","sourceRoot":"","sources":["../src/ExpoLocation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,aAAc,SAAQ,KAAK;IAC/B,IAAI,CAAS;IAEb;QACE,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAC5D,IAAI,CAAC,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CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,iCAAiC;QACrC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,6BAA6B;QACjC,OAAO,mBAAmB,EAAE,CAAC;IAC/B,CAAC;IACD,KAAK,CAAC,6BAA6B;QACjC,OAAO,mBAAmB,EAAE,CAAC;IAC/B,CAAC;CACF,CAAC","sourcesContent":["import { type PermissionResponse, PermissionStatus } from 'expo';\nimport { UnavailabilityError } from 'expo-modules-core';\n\nimport type { LocationLastKnownOptions, LocationObject, LocationOptions } from './Location.types';\nimport { LocationAccuracy } from './Location.types';\nimport { LocationEventEmitter } from './LocationEventEmitter';\n\nclass GeocoderError extends Error {\n code: string;\n\n constructor() {\n super('Geocoder service is not available for this device.');\n this.code = 'E_NO_GEOCODER';\n }\n}\n\n/**\n * Converts `GeolocationPosition` to JavaScript object.\n */\nfunction geolocationPositionToJSON(position: LocationObject): LocationObject {\n const { coords, timestamp } = position;\n return {\n coords: {\n latitude: coords.latitude,\n longitude: coords.longitude,\n altitude: coords.altitude,\n accuracy: coords.accuracy,\n altitudeAccuracy: coords.altitudeAccuracy,\n heading: coords.heading,\n speed: coords.speed,\n },\n timestamp,\n };\n}\n\n/**\n * Checks whether given location didn't exceed given `maxAge` and fits in the required accuracy.\n */\nfunction isLocationValid(location: LocationObject, options: LocationLastKnownOptions): boolean {\n const maxAge = typeof options.maxAge === 'number' ? options.maxAge : Infinity;\n const requiredAccuracy =\n typeof options.requiredAccuracy === 'number' ? options.requiredAccuracy : Infinity;\n const locationAccuracy = location.coords.accuracy ?? Infinity;\n\n return Date.now() - location.timestamp <= maxAge && locationAccuracy <= requiredAccuracy;\n}\n\n/**\n * Gets the permission details. The implementation is not very good as it's not\n * possible to query for permission on all browsers, apparently only the\n * latest versions will support this.\n */\nasync function getPermissionsAsync(shouldAsk = false): Promise<PermissionResponse> {\n if (!navigator?.permissions?.query) {\n throw new UnavailabilityError('expo-location', 'navigator.permissions API is not available');\n }\n\n const permission = await navigator.permissions.query({ name: 'geolocation' });\n\n if (permission.state === 'granted') {\n return {\n status: PermissionStatus.GRANTED,\n granted: true,\n canAskAgain: true,\n expires: 0,\n };\n }\n\n if (permission.state === 'denied') {\n return {\n status: PermissionStatus.DENIED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n };\n }\n\n if (shouldAsk) {\n return new Promise((resolve) => {\n navigator.geolocation.getCurrentPosition(\n () => {\n resolve({\n status: PermissionStatus.GRANTED,\n granted: true,\n canAskAgain: true,\n expires: 0,\n });\n },\n (positionError: GeolocationPositionError) => {\n if (positionError.code === positionError.PERMISSION_DENIED) {\n resolve({\n status: PermissionStatus.DENIED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n });\n return;\n }\n\n resolve({\n status: PermissionStatus.GRANTED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n });\n }\n );\n });\n }\n\n // The permission state is 'prompt' when the permission has not been requested\n // yet, tested on Chrome.\n return {\n status: PermissionStatus.UNDETERMINED,\n granted: false,\n canAskAgain: true,\n expires: 0,\n };\n}\n\nlet lastKnownPosition: LocationObject | null = null;\n\nexport default {\n async getProviderStatusAsync(): Promise<{ locationServicesEnabled: boolean }> {\n return {\n locationServicesEnabled: 'geolocation' in navigator,\n };\n },\n async getLastKnownPositionAsync(\n options: LocationLastKnownOptions = {}\n ): Promise<LocationObject | null> {\n if (lastKnownPosition && isLocationValid(lastKnownPosition, options)) {\n return lastKnownPosition;\n }\n return null;\n },\n async getCurrentPositionAsync(options: LocationOptions): Promise<LocationObject> {\n return new Promise<LocationObject>((resolve, reject) => {\n const resolver: PositionCallback = (position) => {\n lastKnownPosition = geolocationPositionToJSON(position);\n resolve(lastKnownPosition);\n };\n navigator.geolocation.getCurrentPosition(resolver, reject, {\n maximumAge: Infinity,\n enableHighAccuracy: (options.accuracy ?? 0) > LocationAccuracy.Balanced,\n ...options,\n });\n });\n },\n async removeWatchAsync(watchId: number): Promise<void> {\n navigator.geolocation.clearWatch(watchId);\n },\n async watchDeviceHeading(_headingId: number): Promise<void> {\n console.warn('Location.watchDeviceHeading: is not supported on web');\n },\n async hasServicesEnabledAsync(): Promise<boolean> {\n return 'geolocation' in navigator;\n },\n async geocodeAsync(): Promise<any[]> {\n throw new GeocoderError();\n },\n async reverseGeocodeAsync(): Promise<any[]> {\n throw new GeocoderError();\n },\n async watchPositionImplAsync(watchId: number, options: PositionOptions): Promise<number> {\n return new Promise((resolve) => {\n watchId = navigator.geolocation.watchPosition(\n (position) => {\n lastKnownPosition = geolocationPositionToJSON(position);\n LocationEventEmitter.emit('Expo.locationChanged', {\n watchId,\n location: lastKnownPosition,\n });\n },\n undefined,\n options\n );\n resolve(watchId);\n });\n },\n\n async watchMotionActivityImplAsync(_watchId: number): Promise<void> {\n console.warn('Location.watchMotionActivityAsync: is not supported on web');\n },\n\n async getMotionActivityPermissionsAsync(): Promise<PermissionResponse> {\n return {\n status: PermissionStatus.UNDETERMINED,\n granted: false,\n canAskAgain: false,\n expires: 'never',\n };\n },\n\n async requestMotionActivityPermissionsAsync(): Promise<PermissionResponse> {\n return {\n status: PermissionStatus.UNDETERMINED,\n granted: false,\n canAskAgain: false,\n expires: 'never',\n };\n },\n\n async requestForegroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync(true);\n },\n async requestBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync(true);\n },\n async getForegroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync();\n },\n async getBackgroundPermissionsAsync(): Promise<PermissionResponse> {\n return getPermissionsAsync();\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type PermissionResponse } from 'expo';
2
- import type { LocationErrorCallback, LocationCallback, LocationGeocodedAddress, LocationGeocodedLocation, LocationHeadingCallback, LocationHeadingObject, LocationLastKnownOptions, LocationObject, LocationOptions, LocationPermissionResponse, LocationProviderStatus, LocationRegion, LocationSubscription, LocationTaskOptions } from './Location.types';
2
+ import type { LocationErrorCallback, LocationCallback, LocationGeocodedAddress, LocationGeocodedLocation, LocationHeadingCallback, LocationHeadingObject, LocationLastKnownOptions, LocationObject, LocationOptions, LocationPermissionResponse, LocationProviderStatus, LocationRegion, LocationSubscription, LocationTaskOptions, MotionActivityCallback, MotionActivityObject } from './Location.types';
3
3
  /**
4
4
  * Check status of location providers.
5
5
  * @return A promise which fulfills with an object of type [`LocationProviderStatus`](#locationproviderstatus).
@@ -155,6 +155,73 @@ export declare const useBackgroundPermissions: (options?: import("expo-modules-c
155
155
  * or `false` if not.
156
156
  */
157
157
  export declare function hasServicesEnabledAsync(): Promise<boolean>;
158
+ /**
159
+ * Checks user's permissions for accessing motion activity data.
160
+ * @return A promise that fulfills with an object of type [`PermissionResponse`](#permissionresponse).
161
+ *
162
+ * @platform android
163
+ * @platform ios
164
+ */
165
+ export declare function getMotionActivityPermissionsAsync(): Promise<PermissionResponse>;
166
+ /**
167
+ * Asks the user to grant permissions for motion activity detection.
168
+ * On Android 10+, this requests the `ACTIVITY_RECOGNITION` runtime permission.
169
+ * On iOS, this triggers the system prompt for Motion and Fitness access the first time it is called.
170
+ * @return a promise that fulfills with an object of type [`PermissionResponse`](#permissionresponse).
171
+ *
172
+ * @platform android
173
+ * @platform ios
174
+ */
175
+ export declare function requestMotionActivityPermissionsAsync(): Promise<PermissionResponse>;
176
+ /**
177
+ * Checks or requests permissions for motion activity detection.
178
+ * This uses both `requestMotionActivityPermissionsAsync` and `getMotionActivityPermissionsAsync`
179
+ * to interact with the permissions.
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * const [status, requestPermission] = Location.useMotionActivityPermissions();
184
+ * ```
185
+ *
186
+ * @platform android
187
+ * @platform ios
188
+ */
189
+ export declare const useMotionActivityPermissions: (options?: import("expo-modules-core").PermissionHookOptions<object> | undefined) => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>];
190
+ /**
191
+ * Fetches the current motion activity status of the device by subscribing to the first available
192
+ * activity update and immediately unsubscribing afterwards.
193
+ * The returned promise fulfills with the same object shape as the `watchMotionActivityAsync`
194
+ * callback.
195
+ *
196
+ * The method uses the Google Play Services activity
197
+ * recognition (Android) or platform's motion coprocessor (iOS) and does **not** require location permissions.
198
+ * On Android 10+, the `ACTIVITY_RECOGNITION` runtime permission must be granted beforehand.
199
+ * On iOS, the system will prompt the user for Motion and Fitness access the first time this method is called.
200
+ *
201
+ *
202
+ * @return a promise which fulfills with a [`MotionActivityObject`](#motionactivityobject).
203
+ *
204
+ * @platform android
205
+ * @platform ios
206
+ */
207
+ export declare function getMotionActivityAsync(): Promise<MotionActivityObject>;
208
+ /**
209
+ * Subscribes to motion activity updates from the device. The callback fires whenever the
210
+ * platform's motion coprocessor detects a change in the user's activity. Only foreground use
211
+ * is supported - updates pause when the app is backgrounded and resume when it returns to
212
+ * the foreground.
213
+ *
214
+ * @param callback This function is called on each motion activity update. It receives an object
215
+ * of type [`MotionActivityObject`](#motionactivityobject) as the first argument.
216
+ * @param errorHandler This function is called if the platform reports an error (for example,
217
+ * when activity recognition permission is denied). It receives a string message as the
218
+ * first argument.
219
+ * @return a promise which fulfills with a [`LocationSubscription`](#locationsubscription) object.
220
+ *
221
+ * @platform android
222
+ * @platform ios
223
+ */
224
+ export declare function watchMotionActivityAsync(callback: MotionActivityCallback, errorHandler?: LocationErrorCallback): Promise<LocationSubscription>;
158
225
  export declare function isBackgroundLocationAvailableAsync(): Promise<boolean>;
159
226
  /**
160
227
  * Registers for receiving location updates that can also come when the app is in the background.
@@ -1 +1 @@
1
- {"version":3,"file":"Location.d.ts","sourceRoot":"","sources":["../src/Location.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAIxF,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,eAAe,EAC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