geolocation icon indicating copy to clipboard operation
geolocation copied to clipboard

background: true Has no effect

Open RomanJos opened this issue 5 years ago • 6 comments

Hi I just want to understand what background option is for ? Because it feels like wheneve the app get paused by Android the location stream pause also where a timer function normally, I'm trying to get the location and update it on the map but if I press home or recent app for example, Geolocation.locationUpdates don't output anything. I'm am not talking about update when we close the app on the recent app list because its different from each app etc

RomanJos avatar Mar 23 '20 13:03 RomanJos

I Have also tried to set app into background and change location on emulator and after that app Back to foreground. But there is only one location on Result when I get location updates. How often plugin should get location when on background? Tested with android. Also with real phone. Locationupdates function seems to work when app is in foreground

HeikkiK avatar May 02 '20 08:05 HeikkiK

I now use this https://pub.dev/packages/background_locator

RomanJos avatar May 02 '20 13:05 RomanJos

ok thanks, I will check that plugin.

HeikkiK avatar May 02 '20 15:05 HeikkiK

background: true does not work unfortunately. (I have the background capability switched on in Xcode).

logic-emotion avatar May 23 '20 12:05 logic-emotion

For background processing on IOS, it works when adding: locationManager.allowsBackgroundLocationUpdates = true

in: geolocation/ios/Classes/Location/LocationClient.swift

class LocationClient : NSObject, CLLocationManagerDelegate {
.......
.......
override init() {
    super.init()
    locationManager.delegate = self
    locationManager.allowsBackgroundLocationUpdates = true   // <---
  }

and adding in: ios/Runner/Info.plist

<key>UIBackgroundModes</key>
	<array>
		<string>location</string>
	</array>

ghost avatar Jun 16 '20 17:06 ghost

@jeanantoine So you are suggesting that the plugin has a bug and needs updating as well as documentation?

cormalenv avatar Jul 23 '20 12:07 cormalenv