merlos / iOS-Open-GPX-Tracker

GPS Tracker app for iOS + WatchOS. Log your tracks without limits and share them; Open source GPX tracker app written in Swift
http://www.merlos.org/iOS-Open-GPX-Tracker/
GNU General Public License v3.0
605 stars 149 forks source link

iOS 13.5.1: Background tracking not working #161

Closed eliabieri closed 1 year ago

eliabieri commented 4 years ago

I updated my iPhone 7 from iOS 13.3.1 to iOS 13.4 and now the tracking is not continued when I lock my phone.

vincentneo commented 4 years ago

Hi @eliabieri,

Have you checked the location privacy setting again in the Settings app? Just trying to eliminate any possibilities. Regardless, I personally have yet to upgrade to iOS/iPadOS 13.4 on any of my devices yet, so I can't currently test.

Also, does it happen often, all the time, or occasionally when it doesn't track while locked?

Does the tracking go pause, or missing track points / or does the app just 'quits all together', leaving you with the crash recovery dialog when reopen?

Vincent

eliabieri commented 4 years ago

Hey Vincent, I checked and my location setting is set to „always“. Also, it happens every time and it just does not record any locations while in background or when the phones is locked. When I bring the app back into foreground, the tracking resumes. Sometimes, random positions are added when the app goes in the background. I hope this information helped finding the issue. I gladly provide more information if needed.

vincentneo commented 4 years ago

Hi @eliabieri,

So it sounds like iOS isn't providing the app the location data when app is suspended.

I will search around, in case it's a iOS 13.4 thing, as I currently can't think of a possible fix, with those symptoms that you provide. (unless there is yet another API change)

Vincent

eliabieri commented 4 years ago

Update: I was able to resolve the issue by changing the location access from „always“ to „when using the app“ and then back to „always“. Seems like the app lost the permissions to query the locations while it‘s in the background. Feel free to close the issue. Time will tell if other users experience the same problem as I did. Thanks for the help.

vincentneo commented 4 years ago

Hi @eliabieri,

Thanks for the heads up! Looks like Apple's fooling around with us consumers again...

mstonespeedy commented 4 years ago

Can we reopen this issue? I'm having the same problem on an iPhone XS Max with iOS 13.5.1. I don't think this happened with iOS 13.5, but it started with iOS 13.5.1.

Every time my phone locks, GPX Tracker loses background tracking. I can unlock my phone 10 seconds later with the app still open, and the accuracy again starts at 300 feet or so, and then after several seconds it returns to the normal 25 feet or so. I changed the Location setting from "Always" to "While Using the App" and then back to "Always", but that hasn't made a difference.

I've noticed that in the Background App Refresh settings, there is no listing for GPX Tracker. Must there be, for it to work properly?

By the way, thanks for this app. I use it all the time.

vincentneo commented 4 years ago

@mstonespeedy That does sound like a good reason to reopen and revisit the issue. Personally have yet to upgrade from 13.4.1, so I'm unable to test yet.

Does it only occur when locked? If you were to say, start a tracking, and use the phone for something else at around the same timeframe, does the loss of GPS occur also?

I don't recall the app being in the Background App Refresh settings, since I worked/known about on the app, so I doubt that is the cause of the issue.

mstonespeedy commented 4 years ago

@vincentneo Thanks for reopening the issue.

I haven't yet seen it happen when the phone is unlocked with the app in the background. And in my testing today, I've seen the problem only half of the time, but a few times it maintained the location lock even with the phone locked.

One more thing. I usually use the app without a Wi-Fi connection, so I've only seen the problem when using a cellular network connection. I'm not sure if that's part of the issue or not.

mstonespeedy commented 4 years ago

@vincentneo Perhaps adding the app to the Background App Refresh settings would help.

Also, this article looks useful:

https://developer.apple.com/documentation/corelocation/getting_the_user_s_location/handling_location_events_in_the_background

The Overview starts with this:

"Most location services are meant to be used while your app is in the foreground, but some can also run in the background or even cause your app to be launched. To receive events in the background, configure the Location updates capability for your app in Xcode, as shown in Figure 1. You must also set the allowsBackgroundLocationUpdates property of your CLLocationManager object to true."

vincentneo commented 4 years ago

@mstonespeedy,

The article you've shared is very interesting: the project, as is, already has both the checkbox checked as shown in Figure 1 of the link, and has allowBackgroundLocationUpdates set to true too. Yet, in the Settings app, I am not seeing Background App Refresh settings, and that I have just assume that it was never enabled.

"Note Disabling the Background App Refresh setting for the current app, or for all apps, does not prevent the delivery of location events in the background." from the article seems to also suggest that it isn't potentially useful either? I am confused.

Based on the article, I think it's fair to now assume that Background App Refresh is enabled? Not sure why its not showing up in my settings. Not sure if its only my device too 😬.

Frankly, I do not know how to solve this issue. I hope it's not Apple trying to clamp down with their privacy stuff again, or some obscure bug yet again.

merlos commented 4 years ago

I tried today the app in background with iOS 13.5.1, used cell network and wifi off, more than 2h session and I had no issues...

mstonespeedy commented 4 years ago

The app doesn't appear in my Background App Refresh settings either. Does it appear for anyone? Does the project need to be updated to the latest version of Xcode and the iOS toolkit, to avoid issues with the latest versions of iOS?

@merlos Thank you for testing. I tested briefly today and had no problems. I'll report back when I see it again, and hopefully gather more details.

vincentneo commented 4 years ago

Does the project need to be updated to the latest version of Xcode and the iOS toolkit, to avoid issues with the latest versions of iOS?

Considering how this issue is hardly replicable and not widespread meant that the above is probably a no.

Anyways, when you had the issue is Low Power Mode off or on?

mstonespeedy commented 4 years ago

Considering how this issue is hardly replicable and not widespread meant that the above is probably a no.

With which version of the iOS toolkit is this project built? Shouldn't it use the latest version regardless of this issue?

Anyways, when you had the issue is Low Power Mode off or on?

Good question, but Low Power Mode was definitely off. I never use that.

Azhrei commented 4 years ago

Does it appear for anyone?

It does not appear for me.

PS: Thanks for developing this! I have hopes of tweaking it to use as a mileage tracker for myself, but I’m still pretty new to Swift and trying to pick up SwiftUI right now...

cmlcrn17 commented 4 years ago

Hi

I have worked on background task before but they don't suggest it.

Repository: https://github.com/cmlcrn17/Swift5-BackgroundTaskNotification (Not update sorry but I will updating soon)

https://www.andyibanez.com/posts/modern-background-tasks-ios13/ https://www.theverge.com/2019/10/31/20942043/apple-ios-13-iphone-11-pro-ram-memory-management-app-background-refresh https://developer.apple.com/documentation/backgroundtasks/starting_and_terminating_tasks_during_development

merlos commented 1 year ago

Closing issue as it may no longer apply.