Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

iOS: Adding options to use in long-running background tasks #49

Closed
wants to merge 3 commits into from

Conversation

MrVonkey
Copy link
Contributor

Hi,

i'm currently dealing with long-running background tasks on iOS. On iOS versions > 9.0 one can't receive location updates in background in combination with the UIBackgroundModes key location in the Info.plist, because the allowsBackgroundLocationUpdates flag has to be set to true on the used location manager instance (https://developer.apple.com/reference/corelocation/cllocationmanager/1620568-allowsbackgroundlocationupdates). Receiving location updates in background only works by using beginBackgroundTaskWithExpirationHandler, which suspends the background task after about 3 minutes,

Furthermore, long-running background tasks which consume location updates can be suspended if the location updates are paused by the location manager. This behavior can be deactivated by setting the pausesLocationUpdatesAutomatically flag of the location manager instance to false (https://developer.apple.com/reference/corelocation/cllocationmanager/1620553-pauseslocationupdatesautomatical).

It would be nice to have control over these location manager flags to use the plugin in long-running background tasks. Would it be possible to integrate these flags as options?

(tested on iOS 10.2.1)

Copy link

@TLmaK0 TLmaK0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compile.sh lint returns:
source/nativescript-geolocation.ios.ts[327, 1]: Exceeds maximum line length of 120
source/nativescript-geolocation.ios.ts[330, 1]: Exceeds maximum line length of 120

@MrVonkey
Copy link
Contributor Author

@TLmaK0 Thanks! I overlooked that.

@DimitarTachev
Copy link
Contributor

DimitarTachev commented Oct 12, 2017

Great job, @MrVonkey! Welcome to the geo locaiton contributors!

Sorry for the long silence and thanks for the detailed description! I made some README improvements and rebased the changes in order to resolve the conflicts. You could check the updated PR here.

The changes will be part of the 4.1.0 version of the plugin.

@ghost ghost removed the in progress label Oct 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants