Closed GuptaAman08 closed 5 months ago
I've never tested with an iOS Mock Location app. I only use simulated location in XCode (eg: Freeway Drive).
Facing the same issue, code works great with android but on iOS it gives Intermittent location updates when app is in background or kill state
Iβbe been testing iOS daily for almost 9 years. It never fails for me.
Hi @christocracy,
After testing your demo app on the below-mentioned cases, using the xcode way for spoofing location as you mentioned earlier, we observed the same problem - No continuous location updates on iOS builds. If you can please check this once at your end and let me know if I am getting it wrong in understanding some behavior OR some problem with the SDK OR due to something introduced recently in iOS.
Also, I found some similar issues on the Apple forum - https://developer.apple.com/forums/thread/726945. Probably, it is affecting our iOS apps !!. Please confirm.
Observations
Case 1: WhenInUse and motion disabled - Intermittent location updates
Case 2: WhenInUse and motion enabled - Only when you do some movement with phone then update comes
Case 3: Always and motion enabled - same as WhenInuse with motion enabled
Case 4: Always and motion disabled
I can't find the option showsLocationIndicator
in the official document. What this option does ??
Also, the behaviour that i had commented lastly was with your demo app using SDK version 13.3.3. Isn't the issue replicating at your end ??
Also, i have a question which is something out of this questions context that - once the motion and fitness permission is disabled either by explicitly going to the settings or when modal pops up, thereafter if we try to set disableMotionAcitivtyUpdates
as true then I am not able to see the modal. Can you help here please !!
You didn't look hard enough.
Here's the tracking over the past week from my iPhone 13 Pro. It never fails:
hen I am not able to see the modal.
iOS gives you only one chance to request that permission.
iOS gives you only one chance to request that permission
thanks for confirmation
Have you tried with the below circumstances being true for your demo app -
showsBackgroundLocationIndicator
holds a default value of true (as per the documentation).I have used your demo app changing configs to one that I mentioned in the title of this issue under the above circumstances.
I suggest you simulate location using Freeway Drive.
I guess the end goal is to spoof the location. So, requesting you to try once with the demo app under the above circumstances,
2023-09-08 18:16:59.039185+0530 BGGeolocation[8083:1115093] β
-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 35 OF (
35
)
2023-09-08 18:17:01.299080+0530 BGGeolocation[8083:1117972] π΅-[TSLocationManager beginStopDetection] β²Stop-timeout engaged: 1200 s...
2023-09-08 18:17:01.301367+0530 BGGeolocation[8083:1119222] β
-[BackgroundTaskManager createBackgroundTask] 36
2023-09-08 18:17:01.302197+0530 BGGeolocation[8083:1117972] πΎ-[BackgroundTaskManager startKeepAlive]
2023-09-08 18:17:01.302465+0530 BGGeolocation[8083:1119222] π΄-[TSLocationManager stopUpdatingLocation]
2023-09-08 18:17:02.295347+0530 BGGeolocation[8083:1119222]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 18:17:02.295430+0530 BGGeolocation[8083:1119222] π΅-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 18:17:02.295883+0530 BGGeolocation[8083:1119222] π΅-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 0/1200 s
2023-09-08 18:17:13.298023+0530 BGGeolocation[8083:1118796]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 18:17:13.298147+0530 BGGeolocation[8083:1118796] π΅-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 18:17:13.298735+0530 BGGeolocation[8083:1118355] π΅-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 11/1200 s
2023-09-08 18:17:19.622551+0530 BGGeolocation[8083:1117972] βΉοΈ-[TSDBLogger db_save] Log committed
2023-09-08 18:17:24.295402+0530 BGGeolocation[8083:1115093]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 18:17:24.295494+0530 BGGeolocation[8083:1115093] π΅-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 18:17:24.295959+0530 BGGeolocation[8083:1118796] π΅-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 22/1200 s
2023-09-08 18:17:35.297914+0530 BGGeolocation[8083:1117972]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 18:17:35.298064+0530 BGGeolocation[8083:1115093] π΅-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 18:17:35.298461+0530 BGGeolocation[8083:1117972] π΅-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 33/1200 s
2023-09-08 18:17:36.301155+0530 BGGeolocation[8083:1112223] [BackgroundTask] Background Task 36 ("Called by BGGeolocation, from -[BackgroundTaskManager createBackgroundTask]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
2023-09-08 18:17:46.294971+0530 BGGeolocation[8083:1118796]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 18:17:46.295099+0530 BGGeolocation[8083:1115093] π΅-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 18:17:46.295418+0530 BGGeolocation[8083:1118796] π΅-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 44/1200 s
2023-09-08 18:17:57.298800+0530 BGGeolocation[8083:1118796]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 18:17:57.298961+0530 BGGeolocation[8083:1115093] π΅-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 18:17:57.299312+0530 BGGeolocation[8083:1118796] π΅-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 55/1200 s
Logs for the case location auth type as WhenInUse with motion & fitness permission as disabled.
Logs for location auth type as Always and motion & fitness permission as disabled
2023-09-08 13:28:05.903592+0530 BGGeolocation[5620:971993]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService flush:]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:28:05.910443+0530 BGGeolocation[5620:971993] :white_check_mark:-[BackgroundTaskManager createBackgroundTask] 23
2023-09-08 13:28:05.910494+0530 BGGeolocation[5620:970568] :white_check_mark:-[TSHttpService schedulePost] LOCKED: 75070DC5-7211-47BA-A13E-8E5F48EDD93D
2023-09-08 13:28:06.940854+0530 BGGeolocation[5620:971993] :large_blue_circle:-[HttpResponse handleResponse] Response: 200
2023-09-08 13:28:06.948359+0530 BGGeolocation[5620:971887] :white_check_mark:-[TSHttpService post:]_block_invoke DESTROY: 75070DC5-7211-47BA-A13E-8E5F48EDD93D
2023-09-08 13:28:06.948542+0530 BGGeolocation[5620:971888]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService finish:error:] Success: 1
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:28:06.948693+0530 BGGeolocation[5620:971888] :white_check_mark:-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 23 OF (
23
)
2023-09-08 13:28:08.911990+0530 BGGeolocation[5620:970568] :large_blue_circle:-[TSLocationManager beginStopDetection] :timer_clock:Stop-timeout engaged: 1200 s...
2023-09-08 13:28:08.914752+0530 BGGeolocation[5620:971993] :white_check_mark:-[BackgroundTaskManager createBackgroundTask] 24
2023-09-08 13:28:08.915003+0530 BGGeolocation[5620:970568] :tennis:-[BackgroundTaskManager startKeepAlive]
2023-09-08 13:28:08.915237+0530 BGGeolocation[5620:971993] :red_circle:-[TSLocationManager stopUpdatingLocation]
2023-09-08 13:28:09.913362+0530 BGGeolocation[5620:971993]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:28:09.913435+0530 BGGeolocation[5620:971993] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:28:09.913873+0530 BGGeolocation[5620:970568] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 1/1200 s
2023-09-08 13:28:20.907834+0530 BGGeolocation[5620:970568]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:28:20.909825+0530 BGGeolocation[5620:971887] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:28:20.909940+0530 BGGeolocation[5620:970568] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 11/1200 s
2023-09-08 13:28:31.912692+0530 BGGeolocation[5620:970568]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:28:31.912793+0530 BGGeolocation[5620:970568] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:28:31.913179+0530 BGGeolocation[5620:971888] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 23/1200 s
2023-09-08 13:28:37.018553+0530 BGGeolocation[5620:971888] :information_source:-[TSDBLogger db_save] Log committed
2023-09-08 13:28:42.906822+0530 BGGeolocation[5620:971887]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:28:42.909172+0530 BGGeolocation[5620:970483] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:28:42.909301+0530 BGGeolocation[5620:971887] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 33/1200 s
2023-09-08 13:28:43.913496+0530 BGGeolocation[5620:967524] [BackgroundTask] Background Task 24 (βCalled by BGGeolocation, from -[BackgroundTaskManager createBackgroundTask]β), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
2023-09-08 13:28:53.912336+0530 BGGeolocation[5620:970483]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:28:53.912413+0530 BGGeolocation[5620:970483] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:28:53.912788+0530 BGGeolocation[5620:971888] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 45/1200 s
2023-09-08 13:28:55.449336+0530 BGGeolocation[5620:967824] [javascript] β[_handleAppStateChange]β, βinactiveβ
2023-09-08 13:28:56.798814+0530 BGGeolocation[5620:970483] :large_blue_circle:-[BackgroundTaskManager startPreventSuspendTimer:] BG time remaining: 20 | Total tasks: 1
2023-09-08 13:28:56.798876+0530 BGGeolocation[5620:970483] :large_blue_circle:-[TSLocationManager onSuspend:] enabled? 1)
2023-09-08 13:28:56.802486+0530 BGGeolocation[5620:971887] :information_source:-[TSDBLogger db_save] Log committed
2023-09-08 13:28:56.824182+0530 BGGeolocation[5620:967824] [javascript] β[_handleAppStateChange]β, βbackgroundβ
2023-09-08 13:28:56.825435+0530 BGGeolocation[5620:967524] [Snapshotting] Snapshotting a view (0x112024000, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.
2023-09-08 13:29:04.919666+0530 BGGeolocation[5620:971887]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:29:04.920860+0530 BGGeolocation[5620:971887] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:29:04.921284+0530 BGGeolocation[5620:971887] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 55/1200 s
2023-09-08 13:29:15.911456+0530 BGGeolocation[5620:972965]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:29:15.912495+0530 BGGeolocation[5620:972965] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:29:15.913127+0530 BGGeolocation[5620:972965] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 66/1200 s
2023-09-08 13:29:19.652960+0530 BGGeolocation[5620:973102] :large_blue_circle:-[BackgroundTaskManager onResume:] Current preventSuspend tasks: 1
2023-09-08 13:29:19.653025+0530 BGGeolocation[5620:973102] :large_blue_circle:-[TSLocationManager onResume:] enabled? 1
2023-09-08 13:29:19.654456+0530 BGGeolocation[5620:973102] :information_source:-[LocationDAO purge:] 14
2023-09-08 13:29:19.660190+0530 BGGeolocation[5620:972965] :information_source:-[TSDBLogger db_save] Log committed
2023-09-08 13:29:19.665624+0530 BGGeolocation[5620:971887]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService flush:]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:29:19.665923+0530 BGGeolocation[5620:971887]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService finish:error:] Success: 1
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:29:19.962427+0530 BGGeolocation[5620:967824] [javascript] β[_handleAppStateChange]β, βactiveβ
2023-09-08 13:29:26.906993+0530 BGGeolocation[5620:973102]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:29:26.907076+0530 BGGeolocation[5620:973249] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:29:26.907122+0530 BGGeolocation[5620:973102] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 77/1200 s
2023-09-08 13:29:37.904609+0530 BGGeolocation[5620:973248]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:29:37.908837+0530 BGGeolocation[5620:973249] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:29:37.910909+0530 BGGeolocation[5620:973248] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 88/1200 s
2023-09-08 13:29:48.905229+0530 BGGeolocation[5620:973194]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2023-09-08 13:29:48.908440+0530 BGGeolocation[5620:973248] :large_blue_circle:-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 0
2023-09-08 13:29:48.910032+0530 BGGeolocation[5620:973194] :large_blue_circle:-[TSLocationManager detectStopMotion:shakeCount:] Stationary-time: 99/1200 s
The device reports still
. Thus the plugin turns off location-services and waits for stopTimeout
to expire.
If you don't want the plugin to temporarily turn off location-services when the device reports still
(eg: sitting at a stop light, there's no point wasting energy with location updates), see Config.disableStopDetection
.
But, on maps app it still appears that the device is moving
Image that the native LocationAPI provided by iOS is like a telephone call between the OS and the plugin.
When you see this in the logs: " π΄-[TSLocationManager stopUpdatingLocation]", the plugin has hung up the phone.. It cannot be forced to listen to location updates artificially induced by a mock location app.
If you don't want the plugin to "hang up the phone" on your artificially induced location updates, then see API docs Config.disableStopDetection
.
Thanks @christocracy,
This gives a good insight into the SDK. I will try this option and let here know and close it thereafter
Hi @christocracy ,
I tried this option (disableStopDetection: true
) It worked fine on the iOS simulator but I faced one problem on the Android emulator, when I tried to play with lock/unlock the phone the location updates stopped. Mainly when i unlock it after locking it for some 2-3 minutes
Config is the same as mentioned in the issue title just including one more config disableStopDetection: true
on top of it.
Whereas it works fine when I use the combination of WhenInUse location auth type and motion permission as disabled without that option.
Your Environment
react-native -v
): 0.71.4Expected Behavior
Continuous Location updates should arrive at the server when the mock location app (have tried with two different apps) is used and tracking is on.
Actual Behavior
I am getting only a few (2-3) location updates at the start when I start tracking and then the SDK stops sending location updates, event when the mock location app is on and the same is reflected in inbuilt maps app as well
Note: Also, the following behavior is observed when using your demo application (cloning repo locally and running with always location authorization and motion permission as enabled) get only 1-2 location updates at the start and then after a long time later post traveling roughly 8-9 km. Attached below is the image of the same
Steps to Reproduce
Context
Facing location update problem when using SDK with a mock location app
Debug logs
Logs
``` PASTE_YOUR_LOGS_HERE ```