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

Subscribing for location changes while app is suspended in background. #44

Closed
AnthonySmith01 opened this issue Dec 19, 2016 · 4 comments
Milestone

Comments

@AnthonySmith01
Copy link

Is it possible for a Nativescript app to use geolocation while an app is in the background or suspended. For example, Apple provide a Significant-Change Location Service that from my understanding "wakes" the app up for an event?

https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html

Any examples or guidance out there? I've had trouble finding any :)
Basically, I'm trying to make an app that will prompt the user when they encounter a specific location (even if the app isn't currently open).

@nsndeck nsndeck self-assigned this Dec 20, 2016
@AnthonySmith01
Copy link
Author

AnthonySmith01 commented Dec 24, 2016

For anyone looking at this issue, I incorporated the following into my nativescript-geolocation (which seems to work for the significant location api). It's pretty much a modified copy of watchLocation (It's rough and hasn't been thoroughly tested so use with care):

function checkLocation(successCallback, errorCallback, options) {
var locListener = LocationListenerImpl.initWithLocationError(successCallback, errorCallback);
try {
var iosLocManager = LocationMonitor.createiOSLocationManager(locListener, options);
iosLocManager.startMonitoringSignificantLocationChanges();
return locListener.id;
}
catch (e) {
LocationMonitor.stopLocationMonitoring(locListener.id);
errorCallback(e);
return null;
}
}
exports.checkLocation = checkLocation;

@TLmaK0
Copy link

TLmaK0 commented Mar 23, 2017

@MrVonkey
Copy link
Contributor

@TLmaK0 There is a pull request for this issue: #49

@angeltsvetkov angeltsvetkov modified the milestone: vFuture Sep 1, 2017
@DimitarTachev
Copy link
Contributor

The @MrVonkey's changes were merged and the option is available in v4.1.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants