Closed davidecampello closed 2 years ago
Doing some searches, especially thanks to this stackoverflow answer it turned out that iOs turn out locations updates in background after some period and this function can be disabled setting the property
locationManager.pausesLocationUpdatesAutomatically = false
Maybe this can be a property automatically or optionally setted by this plugin.
Looking at CLLocationManager documentation I think also activityType can be an interesting property to expose to plugin users.
I'm doint some tests but the problem looks resolved.
Now I have a problem that some times, when app is in background, something happend that make wkwebview reload and I loose again the data, but I think is another problem, maybe related to my old (iphone 6) device.
If anyone have some experience I'm happy to discuss.
I am looking into your problem with background locations.
In my experience, the WKWebView on iOS is unstable. It can terminate due to memory leaks (of which WebKit has many), excessive memory usage or other bugs. When it crashes, the webViewWebContentProcessDidTerminate
delegate method is called, which in Capacitor reloads the WKWebView. I hope that helps.
@davidecampello can you share more on how you solved this issue using this plugin? I am facing the same thing.
I am hoping this is resolved in v1.2.2 and v0.3.17, please test.
Hi @pshah88, simply i update the file my-app/node_modules/@capacitor-community/background-geolocation/ios/Plugin/Plugin.swift and added the row
manager.pausesLocationUpdatesAutomatically = false
here:
manager.allowsBackgroundLocationUpdates = background
manager.showsBackgroundLocationIndicator = background
manager.pausesLocationUpdatesAutomatically = false
manager.activityType = CLActivityType.otherNavigation
self.watchers.append(watcher)
if call.getBool("requestPermissions") != false {
I also added manager.activityType = CLActivityType.otherNavigation but maybe you don't need it. Here you can find the documentation.
This is a temporary solution and you have not to update the package, or you have to make the update again. Tell me if It's working for you
That is the change I made for the latest release of the plugin.
Hi, thanks for this plugin!
Describe the bug I'm using this plugin for an app and I keep locations always in memory into an array and make an http call only when user click on save button. I show the array as a polilyne in google maps because this is an app for recording sport activity. Some users reported that sometimes on ios the app loose all the positions and they can't save the track done. After some researchws and tests It looks like that after about an hour of use with the app in background or with the screen locked the plugin stop to emit geolocations. I tried this in iphone simulator using the trip simulator and with my phisical device (iphone 6 with ios 12.5.5) with AnyGo, that is a software that simulate gps positions on iphone making a fake trip. And I always done this with xcode console where I can see the events stop. If I turn the screen on the app immediatly restart to work and I can see the new location updates. I'm using the last plugin version.