transistorsoft / background-geolocation-lt

Advanced Background Geolocation & Geofencing SDK for iOS & Android
Other
48 stars 19 forks source link

TSLocationManager sometimes stops randomly and does not call API to provide regular location update #89

Closed sunilw123 closed 4 years ago

sunilw123 commented 4 years ago

Hello Chris, We are using TSLocationManager latest plugin in our project.

For some reason, we see that, the library just stops providing the regular location updates. Our API to post the location update is being called whenever there is a change in location is found. Also it happens that, the person's location has been updated when the app is opened for the first time. But even after travelling to 10 miles away from the home, it does not update the location and location service just stales.

Your Environment

Expected Behavior

The location of the user should be updated when the app is in foreground or background, if user has moved from one place to another.

Actual Behavior

For some reason, we see that, the library just stops providing the regular location updates. Our API to post the location update is being called whenever there is a change in location is found. Also it happens that, the person's location has been updated when the app is opened for the first time. But even after travelling to 10 miles away from the home, it does not update the location and location service just stales.

Steps to Reproduce

  1. Start the app. The location updates.
  2. After putting the device in idle mode for some time and then opening it again on another location, the TSLocationManager does not pick this new location.
  3. So in our app it displays old location.
  4. Even after killing the app, the app should receive location updates.

Context

Updating the location on regular basis if location is changed. => Please let us know, if we change the device location artificially from XCode using Simulator, will be the proper location update?

Debug logs

TSLocation Debug logs

πŸ“<+23.03691864,+72.59210205> +/- 165.00m (speed -1.00 mps / course -1.00) @ 30/05/20, 5:56:19 PM India Standard Time 2020-05-30 17:56:19.391225+0530 Serendipity[1403:276958] πŸ“<+23.03691864,+72.59210205> +/- 165.00m (speed -1.00 mps / course -1.00) @ 30/05/20, 5:56:19 PM India Standard Time

╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: -1.0m | age: 0.0s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• 2020-05-30 17:56:19.391499+0530 Serendipity[1403:276981] ╔═══════════════════════════════════════════════════════════ ════ 2020-05-30 17:56:19.391499+0530 Serendipity[1403:276981] ╔═══════════════════════════════════════════════════════════ \342\225β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: -1.0m | age: 0.0s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• βœ…-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+23.03691864,+72.59210205> +/- 165.00m (speed -1.00 mps / course -1.00) @ 30/05/20, 5:56:19 PM India Standard Time 2020-05-30 17:56:19.392485+0530 Serendipity[1403:276951] βœ…-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+23.03691864,+72.59210205> +/- 165.00m (speed -1.00 mps / course -1.00) @ 30/05/20, 5:56:19 PM India Standard Time 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON 2020-05-30 17:56:19.393801+0530 Serendipity[1403:276951] 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON 2020-05-30 17:56:19.395419+0530 Serendipity[1403:276707] *** event motionchange: <TSLocation: 0x282d0cbb0>, { isMoving = 1; location = { activity = { confidence = 100; type = still; }; battery = { "is_charging" = 1; level = "0.79"; }; coords = { accuracy = 165; altitude = 55; "altitude_accuracy" = 10; floor = ""; heading = "-1"; latitude = "23.03691863999999"; longitude = "72.59210204999997"; speed = "-1"; }; event = motionchange; extras = { }; "is_moving" = 1; odometer = "195105790.9"; timestamp = "2020-05-30T12:26:19.371Z"; uuid = "FC0F5D25-5EA2-4CA4-B66A-545E3170FFBA"; }; } πŸ”΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 165.0 2020-05-30 17:56:19.396274+0530 Serendipity[1403:276958] πŸ”΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 165.0 πŸ”΅-[TSLocationManager changePace:] isMoving: 1 2020-05-30 17:56:19.403996+0530 Serendipity[1403:276958] πŸ”΅-[TSLocationManager changePace:] isMoving: 1 πŸ”΅-[TSLocationManager setPace:] 1 2020-05-30 17:56:19.405950+0530 Serendipity[1403:276981] πŸ”΅-[TSLocationManager setPace:] 1 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON 2020-05-30 17:56:19.406193+0530 Serendipity[1403:276981] 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON

You can contact me on yunus.luniwala@brainvire.com Thanks

christocracy commented 4 years ago

when the app is opened for the first time. But even after travelling to 10 miles

It’s seems you’re not yet aware of changes to iOS 13 location authorization

sunilw123 commented 4 years ago

Hello Chris, We are already forcing the user to apply "Always" permission for the location. So it should not be the case. Thanks

christocracy commented 4 years ago

You cannot β€œforce” the user to choose.

sunilw123 commented 4 years ago

We are not forcing the user, but we are showing them guiding screens using which they will choose "Always" for the location settings for our app. Thanks

christocracy commented 4 years ago

Did you read the blog I posted? Do you understand the implications of this for background-location tracking after first install of the app?

sunilw123 commented 4 years ago

Hi Chris. Yes we actually force the user during onboarding process to select Always by going into settings. Otherwise they are not allowed to even login to our app. The problem we are experiencing is that every so often tracking just stops show user in middle of freeway not moving when we know they are moving. And then it starts up later. So for periods of time it just stops working then restarts and we don’t know why. Should we send you logs? Or how to debug this problem?

christocracy commented 4 years ago

every so often tracking just stops show user in middle of freeway

Are you monitoring your app for iOS crashes, not necessarily related to the plugin?

sunilw123 commented 4 years ago

Yes we are using firebase for that.

On Sat, May 30, 2020 at 8:31 AM Chris Scott notifications@github.com wrote:

every so often tracking just stops show user in middle of freeway

Are you monitoring your app for iOS crashes, not necessarily related to the plugin?

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/background-geolocation-lt/issues/89#issuecomment-636346986, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIO7DNMS4E4MDHBOSDBPGO3RUERFDANCNFSM4NOVWSBQ .

-- Sunil Wagle

christocracy commented 4 years ago

Also, if the user explicitly terminates your app, you will experience tracking stop for a period of time then automatically resume after the user moves about 200 meters.

sunilw123 commented 4 years ago

Ok so if they kill the app then this happens. Problem is that we are experiencing this without that happening. We aren’t touching the app while driving and it shows user stopped on a Chicago freeway for hours. Then restarts some hours later.

christocracy commented 4 years ago

Is this just one user who is experiencing this?

sunilw123 commented 4 years ago

Sadly no. It’s happening to all users on the app.

christocracy commented 4 years ago

Are you reproducing this yourself?

christocracy commented 4 years ago

You see nothing interesting in your Firebase Crashalytics?

sunilw123 commented 4 years ago

It’s happening on all tests and when testing it internally.

christocracy commented 4 years ago

If you can reproduce this yourself, then configure logLevel: tsLogLevelVerbose and use emailLog to fetch logs. Attach that log-file here in this issue thread.

sunilw123 commented 4 years ago

Nope. Developers keep checking that and so far nothing.

sunilw123 commented 4 years ago

Ok will do. Thx

sunilw123 commented 4 years ago

Hello Chris, Herewith attaching two .gz files, that we have captured by enabling the Verbose log and 'emailLog'. background-geolocation.log.gz background-geolocation (1).log.gz

Thanks.

sunilw123 commented 4 years ago

Hello Chirs, It seems that the library in iOS is working in a proper way thereby updating the addresses. In order to examine the same for Android, we recorded a video, where we Jayne (IOS app) and another user's phone (Android - Sammy) are in the same care with us.

Herewith attaching more details regarding some malfunction of the TSLocationManager Library on Android.

https://youtu.be/FlPwY_YJTF8

If you observe the video, the addresses are being updated properly in the iOS app but the same is not happening in Android. Do we need to enable some other flags in order to achieve the same behavior as that of iOS one?

Be sure to look at the distance. Jaynes always shows 0.00 because that is the distance away from me. Which is correct.
But android phone with Sammy account shows it is far away from my phone thereby showing all wrong addresses.

Can you please look into this and let me know if anything else is needed from my end? I look forward to hearing from you. Thanks.

christocracy commented 4 years ago

Platform: iOS (Objective C) OS version: 13.5 Device manufacturer / model: iPhone 8

This issue, titled "TSLocationManager sometimes stops randomly and does not call API to provide regular location update" is related to iOS. Support issues are not generalized personal random support threads. They are targeted to a specific problem on a specific platform, iOS / Android.

sunilw123 commented 4 years ago

H Chris, Thanks for your message. I don't think the team clearly communicated the issue to you. We installed transistorsoft on both ios and android. I took one IOS phone (Jayne, iPhone 6plus)) in the video, and an android phone (Sammy - Samsung moto g6). So both phones were in the car and when I drove, the addresses that came back were different. The IOS was spot on showing the exact street I was on. The android though was give like cross streets or streets that were further away than our actual location. If you see this video: https://www.youtube.com/watch?v=FlPwY_YJTF8&feature=youtu.be, you will see that on the right side it shows the distance in miles that this person is away from me. So because I had my phone (iPhone 10) on me and these two other phones it technically should always show 0 there. But that is not what happened. It would show up to over a half a mile away. From apple device to apple device it was working great and almost always showing no distance between the 2 phones. But android we found a big problem. In fact, I even parked and just took both phones out of the car and held them both in my and the Samsung phone kept jumping distances even up to .7 miles away from me. So the question we have for you is, is this normal or did we screw up on the installation. I have attached the Samsung log files for your review. Please let us know. Thanks Chris. background-geolocation.log.gz

christocracy commented 4 years ago

Platform: iOS (Objective C)

This thread is related to iOS.

If you have a problem related to Android, post a new issue.

sunilw123 commented 4 years ago

Hi Chris, Attached are the log files for my father using the app. His location tracking is stopping for some time then starts again. I also attached a screenshot of my dad's location that it kept showing him at. It was from July 13, at around 12:55pm PST. I see a lot in logs showing errors at 12:47 mark. But please look and let me know what you think we are doing wrong. Here is what the developers have noticed:

The TSLocationManager library sometimes being stopped randomly and giving -1 as a speed The exact reason could not be still found from these logs as why the library stopped As I observe other logs, the library then automatically resumed to function and then started providing the location updates One more strange thing found is that at that time, even the user is moving, the "isMoving" flag is not coming as true, which is responsible to detect the physical movement of the user and corresponding location update

Example from the log that I found: <+43.21362381,-88.00061450> +/- 65.00m (speed -1.00 mps / course -1.00) @ 7/11/20, 12:03:01 PM Central Daylight Time

β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 505.8s

Please note that my dad was driving and he did move miles away from that location so the 200 meter issue where it would restart would have been met in just a few minutes of driving. Please let me know what you think could be happening and if there is anything we need to fix. thanks.

F92500AF-D083-41E4-8BD4-A26ABAEFC9C1

background-geolocation (1).log.gz

christocracy commented 4 years ago

I see a lot in logs showing errors at 12:47 mark

There are no errors. This is not an error, it's completely normal and expected:

2020-07-13 12:47:00.615 ⚠️-[TSHttpService flush:error:] Busy with previous request

The device at this time is moving at highway speed, insanely configured with {distanceFilter: 3, disableElasticity: true}, thus recording an IMMENSE amount of data (about 1 location/second). The plugin's HTTP operates synchronously, one request at-a-time, thus "Busy with previous request" is to be expected. There is no problem here.

my dad's location that it kept showing him at. It was from July 13, at around 12:55pm PST.

He stopped and went to the PNC Bank

2020-07-13 12:54:39.926 
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
.
2020-07-13 12:54:40.241 
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
.
2020-07-13 12:54:40.241 πŸ”΅-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 10 seconds...
.
2020-07-13 12:54:43.996 
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
.
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
.
2020-07-13 12:54:44.312 πŸ”΅-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 10 seconds...
.
2020-07-13 12:54:44.932 
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
.
2020-07-13 12:54:45.248 
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
.
2020-07-13 12:54:46.187 
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2020-07-13 12:54:46.187 ℹ️-[TSLocationManager resetMotionTriggerTimer] 

2020-07-13 12:54:46.498 
╔═══════════════════════════════════════════════════════════
β•‘ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2020-07-13 12:54:46.498 πŸ”΅-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 10 seconds...

The TSLocationManager library sometimes being stopped randomly and giving -1 as a speed Example from the log that I found: <+43.21362381,-88.00061450> +/- 65.00m (speed -1.00 mps / course -1.00) @ 7/11/20, 12:03:01 PM Central Daylight Time

This device was inside a house! There is NO GPS WHEN INDOORS. Speed is only available when location comes from GPS. When indoors, the location comes from Wifi provider, whose accuracy is typically 40-100 meters, just as this location shows.

sunilw123 commented 4 years ago

Hi Chris. Thanks for your insight. So I took this image at 10:58pm. The problem is that my dads home is about a half a mile from where this screenshot shows. He was never just sitting at this location for ten hours. He was driving home and it showed him just sitting there for over ten hours. Is there a lat long sending issue where it is not sending the correct latitude and longitude for a long period of time? How else can I keep finding issues where users are just stuck on a freeway way for 5 hours and not moving?.

sunilw123 commented 4 years ago

Sorry I deleted the one I posted but can't delete yours. Any idea on an answer to the question about lat long?

christocracy commented 4 years ago

The problem is that my dads home is about a half a mile from where this screenshot shows

The plugin typically requires movement of 200 meters before the plugin enters the moving state. It can take longer depending on the presence of Wifi signals in the environment. It could take 1km or more in some cases.

sunilw123 commented 4 years ago

Ok so that explains why it didn't update but if he was driving the whole time and didn't stop then how can we explain why it stopped sending at that location. Is that because of the settings we made where the data it was sending was just too much that it stopped sending there? Because we set it to send every 9 feet of movement but it didn't. So I guess question is why did it stop sending there? Are our settings set wrong with distance filter and disable elasticity?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.