Open grabkipower opened 5 years ago
@mauron85 I am sorry for being pushy, but do you have a clue about this one? iOS 13 releases tomorrow, there might be a great impact if the background geoloc report would not work in the background. For now, the issue still persists.
It seems to be a general issue with iOS 13.
But i dont have any idea atm to solve the issue :/
@busaku Mhm, thank you for the reply, well, at least I am not the only one fighting this bug.
Is seems the issue happens only with ACTIVITY_PROVIDER, when using RAW_PROVIDER (and app has proper permissions) geolocation in background works fine.
Hello @tkondej how to change that setting?
@itcurves simply by specifying locationProvider, check the example https://github.com/mauron85/cordova-plugin-background-geolocation#example
@tkondej, I'm still having issues with background data sending to my server using RAW_PROVIDER - I currently use DISTANCE_FILTER_PROVIDER but I switched to RAW_PROVIDER for testing. Both fail. I was wondering if you could explain what you mean by "and app has proper permissions". My app used to work prior to IOS13 so I was wondering if there is a new permission required for IOS13?
@stgraham2000 on iOS 13 you have to enable access to use "geolocation always" in application settings or by accepting additional prompt which popups when after locking and unlocking the phone, check this article for more details https://medium.com/@transistorsoft/ios-13-and-android-q-support-beb7595d2c24
@tkondej, interesting, I had the "always on" under permissions for most of the day and it appeared to be broken, but it looks like another thing to look out for is you need to go for a longer distance test run. In earlier tests today I was probably only walking maybe 50m (around my office). I just tried again by doing a short drive and the points were collected as I expected. Before when I was testing on ios12 I could get points with a much shorter distance travelled. This will be an interesting usability issue to address as the article you referenced also indicates.
It looks like this should still be possible to accomplish location updates while the permissions are set to "while in use":
https://developer.apple.com/documentation/corelocation/getting_the_user_s_location/handling_location_events_in_the_background https://developer.apple.com/documentation/corelocation/cllocationmanager/1620568-allowsbackgroundlocationupdates
I will experiment with this in the morning and report back
Any news? :)
Unfortunately, I took horrible notes on this investigation but I have fixed the problem and here are the changes I have in the commit that fixed this...
3.0.0-alpha.50
to 3.1.0
startForeground: true, # Unset prior
pauseLocationUpdates: false # Unset prior
stationaryRadius: 10 # Used to be 50
this.backgroundGeolocation.finish()
at the end of the location handler. I removed these.I hope one of the above changes works for you. Sorry I can't be of more help.
Hello, please look at my posts #684
In your config.xml be sure to add the following configuration under the iOs platform xml node:
<config-file parent="UIBackgroundModes" target="*-Info.plist">
<array>
<string>fetch</string>
</array>
<array>
<string>location</string>
</array>
<array>
<string>processing</string>
</array>
</config-file>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>need location access to find things nearby</string>
</edit-config>
that's equivalent to the following setup from Xcode
@jackie-d - Give a try to this plugin-
https://www.npmjs.com/package/cordova-plugin-bg-geolocation https://github.com/Anuj-Raghuvanshi/cordova-plugin-bg-geolocation
This works, Thanks!
I have finally got this to work on a real device! the key change: locationProvider: BackgroundGeolocation.RAW_PROVIDER i,e, do NOT use ACTIVITY_PROVIDER as shown in the geolocation example in the docs as this doe NOT work in the background on IOS devices as explained here https://github.com/mauron85/cordova-plugin-background-geolocation/blob/HEAD/PROVIDERS.md
I am not sure the settings mentioned above are also required in the config.xml file under the 'ios platform' sectio. I suspect the default already set by the plugin (i.e. 'location') might be sufficient.
@tfelici - Can you please share reference of your plugin if you have forked and made changes? I also facing same issue.
I have not done any fork. I am using the vanilla 3.1.0 version
Kind regards
Tom On 11/09/2020 12:05, Anuj Singh wrote:
@tfelici https://github.com/tfelici - Can you please share reference of your plugin if you have forked and made changes? I also facing same issue.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mauron85/cordova-plugin-background-geolocation/issues/619#issuecomment-691029600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PYTFAC43VNIMXLF3LQC3SFH76BANCNFSM4IU5AYGQ.
ok - after further tests I can confirm this woks on IOS 13.7 on my daughter's iphone and ipad. Here are the relevant settings in BackgroundGeolocation.configure
BackgroundGeolocation.configure({
locationProvider: BackgroundGeolocation.RAW_PROVIDER,
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
pauseLocationUpdates: false, // need this for IOS I think (default was false anyhow but maybe not)
stationaryRadius: 20,
distanceFilter: 20, // docs say this is dinamically changed when locationProvider = DISTANCE_FILTER_PROVIDER
});
you do NOT need to add the extra lines in config.xml under the IOS platform section
<config-file parent="UIBackgroundModes" target="*-Info.plist">
<array>
<string>location</string>
</array>
<array>
<string>processing</string>
</array>
</config-file>
unless you require to app to refresh other stuff in the background, other than location updates and posting
Hi, there are two ways to works geolocation in background, the first is as you commented with RAW_PROVIDER and the second is setting up in locationProvider: backgroundGeolocation.DISTANCE_FILTER_PROVIDER and call in your event location the method switchMode to force foreground and with this continue reporting in base to option.desiredAccuracy and option.distanceFilter
BackgroundGeolocation.on('location', function(location) { // handle your locations here // switch to FOREGROUND mode BackgroundGeolocation.switchMode(BackgroundGeolocation.FOREGROUND_MODE); })
But I have a question, in the two ways this works and I can see blue in the status bar that means an app is actively using your location. Can this drain the battery? is not sending location until you reach your distance filter but this is always in the status bar. How can I stop showing this status bar in blue? this should show only when I get the location with the icon of location Below when the app send location I hope anyone see this.
Seems like the geolocation is not reported when the app runs in background despite the "Always" permission is set
Your Environment
cordova -v
): 9.0.0 (cordova-lib 9.0.1)cordova platform ls
): ios 5.0.1Context
On iOS 13.1 when the user has checked in the settings of the app the "always" permission for the iOS, the location is not beeing recorded after one leaves the app (switches the app to background i.e.).
I can see that on the navtive Cordova Background Geolocation It this issue has been already raised and solved: transistorsoft/cordova-background-geolocation-lt#952
Expected Behavior
The Geolocation should be properly sent even if the app is in the background
Steps to Reproduce