diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj
index 42df25130..32ae99e50 100644
--- a/CrossPlatformModules.csproj
+++ b/CrossPlatformModules.csproj
@@ -99,10 +99,12 @@
details-page.xml
-
- binding_tests.xml
+
+ main-page.xml
+
+
+ location-example.xml
-
@@ -248,6 +250,15 @@
+
+ location.d.ts
+
+
+ location.d.ts
+
+
+ location.d.ts
+
@@ -527,13 +538,6 @@
-
- location-manager.d.ts
-
-
-
- location-manager.d.ts
-
@@ -549,7 +553,7 @@
-
+
@@ -699,9 +703,6 @@
file-system.d.ts
-
- location.d.ts
-
diff --git a/apps/tests/app/binding_tests.ts b/apps/tests/app/binding_tests.ts
deleted file mode 100644
index f1f17eba7..000000000
--- a/apps/tests/app/binding_tests.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-import pageModule = require("ui/page");
-//import stackLayoutModule = require("ui/layouts/stack-layout");
-//import textFieldModule = require("ui/text-field");
-import buttonModule = require("ui/button");
-import observableModule = require("data/observable");
-import observableArray = require("data/observable-array");
-import bindableModule = require("ui/core/bindable");
-//import enums = require("ui/enums");
-import trace = require("trace");
-trace.setCategories(trace.categories.Test + "," + trace.categories.Binding);
-trace.enable();
-
-export function pageLoaded(args: observableModule.EventData) {
- var page: pageModule.Page = args.object;
- var model = new observableModule.Observable();
- var tasks = new observableArray.ObservableArray();
- //tasks.push("tralala");
- //var model = page.bindingContext;
- model.set("tasks", tasks);
- model.set("paramProperty", "%%%");
- var toUpperConverter: bindableModule.ValueConverter = {
- toModel: function (value, param1) {
- return param1 + value.toLowerCase();
- },
- toView: function (value, param1) {
- if (value === 0) {
- return "no items";
- }
- return value + " items";
- }
- };
- model.set("toUpper", toUpperConverter);
- model.set("testProperty", "Alabala");
-
- var dateConverter = {
- toView: function (value, format) {
- var result = format;
- var day = value.getDate();
- result = result.replace("dd", month < 10 ? "0" + day : day);
- var month = value.getMonth() + 1;
- result = result.replace("mm", month < 10 ? "0" + month : month);
- result = result.replace("yyyy", value.getFullYear());
- return result;
- },
- toModel: function (value, format) {
- var ddIndex = format.indexOf("dd");
- var day = parseInt(value.substr(ddIndex, 2));
- var mmIndex = format.indexOf("mm");
- var month = parseInt(value.substr(mmIndex, 2));
- var yyyyIndex = format.indexOf("yyyy");
- var year = parseInt(value.substr(yyyyIndex, 4));
- var result = new Date(year, month - 1, day);
- return result;
- }
- }
-
- model.set("dateConverter", dateConverter);
- model.set("testDate", new Date());
-
- page.bindingContext = model;
-}
-
-export function onTap(args: observableModule.EventData) {
- var button: buttonModule.Button = args.object;
- trace.write("tasks: " + button.bindingContext.get("testDate"), trace.categories.Test, trace.messageType.info);
- //button.bindingContext.get("tasks").push("alabala");
-}
-
-//export function createPage() {
-// var stackLayout = new stackLayoutModule.StackLayout();
-// var firstTextField = new textFieldModule.TextField();
-// firstTextField.updateTextTrigger = enums.UpdateTextTrigger.textChanged;
-// var secondTextField = new textFieldModule.TextField();
-// secondTextField.updateTextTrigger = enums.UpdateTextTrigger.textChanged;
-
-// var model = new observableModule.Observable();
-
-// var bindOptions: bindableModule.BindingOptions = {
-// sourceProperty: "testProperty",
-// targetProperty: "text",
-// twoWay: true,
-// expression: "testProperty | toUpper('$$$')"
-// };
-
-// firstTextField.bind(bindOptions, model);
-// secondTextField.bind({
-// sourceProperty: "testProperty",
-// targetProperty: "text",
-// twoWay: true
-// }, model);
-
-// stackLayout.addChild(firstTextField);
-// stackLayout.addChild(secondTextField);
-
-// var page = new pageModule.Page();
-// page.on("loaded", pageLoaded);
-// page.content = stackLayout;
-// page.bindingContext = model;
-// return page;
-//}
\ No newline at end of file
diff --git a/apps/tests/app/binding_tests.xml b/apps/tests/app/binding_tests.xml
deleted file mode 100644
index 51b7f1736..000000000
--- a/apps/tests/app/binding_tests.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/tests/app/location-example.ts b/apps/tests/app/location-example.ts
index a35703734..482a5e81d 100644
--- a/apps/tests/app/location-example.ts
+++ b/apps/tests/app/location-example.ts
@@ -1,94 +1,69 @@
import pages = require("ui/page");
-import gridLayoutModule = require("ui/layouts/grid-layout");
-import bm = require("ui/button");
import locationModule = require("location");
import dialogsModule = require("ui/dialogs");
-import trace = require("trace");
import platformModule = require("platform");
import textViewModule = require("ui/text-view");
+import observable = require("data/observable");
+import appModule = require("application");
-export function createPage() {
- function printLocation(location: locationModule.Location) {
- return "longitude: " + location.longitude + ", " +
- "latitude: " + location.latitude + ", " +
- "timeStamp: " + location.timestamp + ", " +
- "horizontalAccuracy: " + location.horizontalAccuracy + ", " +
- "verticalAccuracy: " + location.verticalAccuracy;
- }
+var locationManager = new locationModule.LocationManager();
- var locationManager = new locationModule.LocationManager();
+export function onStartButtonTap(args: observable.EventData) {
+ console.log("Start button tapped");
+ var textView = (page.getViewById("textView"));
+ locationManager.startLocationMonitoring(function (location) {
+ console.log("location-example.location: " + printLocation(location));
+ textView.text = printLocation(location) + "\r\n" + textView.text;
+ }, null, { desiredAccuracy: 300, maximumAge: 20000, minimumUpdateTime: 5000, updateDistance: 20 });
+}
- var textView = new textViewModule.TextView();
- textView.editable = false;
- textView.style.fontSize = 8;
+function printLocation(location: locationModule.Location) {
+ return "longitude: " + location.longitude + ", " +
+ "latitude: " + location.latitude + ", " +
+ "timeStamp: " + location.timestamp + ", " +
+ "horizontalAccuracy: " + location.horizontalAccuracy + ", " +
+ "verticalAccuracy: " + location.verticalAccuracy;
+}
- var startButton = new bm.Button();
- startButton.text = "Start";
- startButton.on(bm.knownEvents.tap, function (eventData) {
- locationManager.startLocationMonitoring(function (location) {
- trace.write("location: " + printLocation(location), trace.categories.Test, trace.messageType.info);
- textView.text = printLocation(location) + "\r\n" + textView.text;
- }, null, {desiredAccuracy: 3, maximumAge: 20000, minimumUpdateTime: 5000, updateDistance: 0});
- });
+export function onStopButtonTap(args: observable.EventData) {
+ locationManager.stopLocationMonitoring();
+}
- var stopButton = new bm.Button();
- stopButton.text = "Stop";
- stopButton.on(bm.knownEvents.tap, function (eventData) {
- locationManager.stopLocationMonitoring();
- });
+export function onRequestButtonTap(args: observable.EventData) {
+ checkLocationService(page);
+}
- var grid = new gridLayoutModule.GridLayout();
+var page: pages.Page;
- grid.addRow(new gridLayoutModule.ItemSpec(1, gridLayoutModule.GridUnitType.auto));
- grid.addRow(new gridLayoutModule.ItemSpec());
-
- grid.addColumn(new gridLayoutModule.ItemSpec(100, gridLayoutModule.GridUnitType.pixel));
- grid.addColumn(new gridLayoutModule.ItemSpec());
+export function pageLoaded(args: observable.EventData) {
+ page = (args.object);
+}
- gridLayoutModule.GridLayout.setColumn(startButton, 0);
- gridLayoutModule.GridLayout.setColumn(stopButton, 1);
- gridLayoutModule.GridLayout.setRow(textView, 1);
- gridLayoutModule.GridLayout.setColumnSpan(textView, 2);
-
- grid.addChild(startButton);
- grid.addChild(stopButton);
- grid.addChild(textView);
-
- var checkLocationService = function (page: pages.Page) {
- if (locationModule.LocationManager.isEnabled()) {
- trace.write("LocationManager.isEnabled", trace.categories.Test, trace.messageType.info);
- }
- else {
- trace.write("LocationManager.is not Enabled", trace.categories.Test, trace.messageType.info);
- if (page.android) {
- dialogsModule.confirm({
- message: "Location service is not enabled!",
- okButtonText: "Open location settings ...",
- cancelButtonText: "Cancel", title: "Confirm"
- }).then((r) => {
- if (r) {
- (page._context).startActivityForResult(new android.content.Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);
- }
- }, null);
- }
- else if (page.ios) {
- if (platformModule.device.osVersion.indexOf("8") === 0) {
- var iosLocationManager = CLLocationManager.alloc().init();
- iosLocationManager.requestWhenInUseAuthorization();
- }
- }
- }
- }
-
- var page = new pages.Page();
-
- page.on("loaded", function () {
- checkLocationService(page);
- page.frame.on("loaded", function () {
- checkLocationService(page);
- });
- });
-
- page.content = grid;
- return page;
+var checkLocationService = function (page: pages.Page) {
+ if (locationModule.LocationManager.isEnabled()) {
+ console.log("LocationManager.isEnabled");
+ }
+ else {
+ console.log("LocationManager.is not Enabled");
+ if (page.android) {
+ dialogsModule.confirm({
+ message: "Location service is not enabled!",
+ okButtonText: "Open location settings ...",
+ cancelButtonText: "Cancel", title: "Confirm"
+ }).then((r) => {
+ if (r) {
+ // do not forget to add android.permission.ACCESS_FINE_LOCATION in your manifest file
+ (appModule.android.currentContext).startActivityForResult(new android.content.Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);
+ }
+ }, null);
+ }
+ else if (page.ios) {
+ if (platformModule.device.osVersion.indexOf("8") === 0) {
+ // we need special handling of iOS 8.0 version, since some breaking changes regarding location
+ // do not forget to put NSLocationWhenInUseUsageDescription in app.plist file
+ var iosLocationManager = CLLocationManager.alloc().init();
+ iosLocationManager.requestWhenInUseAuthorization();
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/apps/tests/app/location-example.xml b/apps/tests/app/location-example.xml
new file mode 100644
index 000000000..ab17efc7d
--- /dev/null
+++ b/apps/tests/app/location-example.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/apps/tests/location-tests.ts b/apps/tests/location-tests.ts
index 829dd3873..3aa8eb10b 100644
--- a/apps/tests/location-tests.ts
+++ b/apps/tests/location-tests.ts
@@ -27,6 +27,7 @@ export function tearDown() {
export var testIsEnabled = function () {
if (!locationIsEnabled) {
+ console.log("Location service is not enabled!!!");
return;
}
//
@@ -182,7 +183,7 @@ export var testSnippet = function (done) {
//
// ``` JavaScript
// var locationModule = require("location");
- //// options can also look like { maximumAge: 2000, timeout: 20 }
+ //// options can also look like { maximumAge: 2000, timeout: 20 * 1000 }
locationModule.getLocation({ maximumAge: 30000, timeout: 0 }).then(function (location) {
//console.log('Location received: ' + location);
//
diff --git a/location/location.ts b/location/location-common.ts
similarity index 85%
rename from location/location.ts
rename to location/location-common.ts
index 2fbf22c97..3a5ac0a16 100644
--- a/location/location.ts
+++ b/location/location-common.ts
@@ -1,14 +1,15 @@
-
-import timer = require("timer");
-import locationManagerModule = require("location/location-manager");
+import timer = require("timer");
+//import locationManagerModule = require("location/location-manager");
import defModule = require("location");
// merge the exports of the types module with the exports of this file
-import merger = require("utils/module-merge");
-declare var exports;
-merger.merge(locationManagerModule, exports);
+//import merger = require("utils/module-merge");
+//declare var exports;
+//merger.merge(locationManagerModule, exports);
-export class Location {
+var defaultGetLocationTimeout = 20000;
+
+export class Location implements defModule.Location {
public latitude: number;
public longitude: number;
@@ -29,7 +30,7 @@ export class Location {
export var getLocation = function (options?: defModule.Options): Promise {
var timerId;
- var locationManager = new locationManagerModule.LocationManager();
+ var locationManager = new defModule.LocationManager();
if (options && (0 === options.timeout)) {
return new Promise((resolve, reject) => {
@@ -54,7 +55,7 @@ export var getLocation = function (options?: defModule.Options): Promise((resolve, reject) => {
- if (!locationManagerModule.LocationManager.isEnabled()) {
+ if (!defModule.LocationManager.isEnabled()) {
return reject(new Error("Location service is disabled"));
}
locationManager.startLocationMonitoring(function (location: defModule.Location) {
@@ -89,7 +90,7 @@ export var getLocation = function (options?: defModule.Options): Promise any, onError?: (error: Error) => any, options?: Options);
-
- /**
- * Stops location monitoring
- */
- stopLocationMonitoring();
-
- // other
-
- /**
- * Returns last known location from device's location services or null of no known last location
- */
- lastKnownLocation: Location;
-}
diff --git a/location/location-manager.android.ts b/location/location.android.ts
similarity index 74%
rename from location/location-manager.android.ts
rename to location/location.android.ts
index c37dc0b06..ca440c89e 100644
--- a/location/location-manager.android.ts
+++ b/location/location.android.ts
@@ -1,18 +1,29 @@
import enums = require("ui/enums");
import appModule = require("application");
import locationModule = require("location");
+import common = require("location/location-common");
-export class LocationManager {
+import merger = require("utils/module-merge");
+declare var exports;
+merger.merge(common, exports);
+
+export class LocationManager implements locationModule.LocationManager {
+ get android(): locationModule.AndroidLocationManager {
+ return this.androidLocationManager;
+ }
+
+ get ios(): locationModule.iOSLocationManager {
+ return undefined;
+ }
+
+ public isStarted: boolean;
// in meters
public desiredAccuracy: number;
// The minimum distance (measured in meters) a device must move horizontally before an update event is generated.
public updateDistance: number;
- // minimum time interval between location updates, in milliseconds (android only)
- public minimumUpdateTime: number;
-
- private androidLocationManager: any;
+ private androidLocationManager: locationModule.AndroidLocationManager;
private _locationListener: any;
@@ -60,7 +71,6 @@ export class LocationManager {
location.direction = androidLocation.getBearing();
location.timestamp = new Date(androidLocation.getTime());
location.android = androidLocation;
- //console.dump(location);
return location;
}
@@ -108,17 +118,18 @@ export class LocationManager {
}
constructor() {
+ //super();
this.desiredAccuracy = enums.Accuracy.any;
this.updateDistance = 0;
- this.minimumUpdateTime = 200;
-
- this.androidLocationManager = appModule.android.context.getSystemService(android.content.Context.LOCATION_SERVICE);
+
+ //this.androidLocationManager = appModule.android.context.getSystemService(android.content.Context.LOCATION_SERVICE);
+ var alm = appModule.android.context.getSystemService(android.content.Context.LOCATION_SERVICE);
+ this.androidLocationManager = new AndroidLocationManager(alm);
+ this.androidLocationManager.minimumUpdateTime = 200;
}
public startLocationMonitoring(onLocation: (location: locationModule.Location) => any, onError?: (error: Error) => any, options?: locationModule.Options) {
var criteria = new android.location.Criteria();
- criteria.setAccuracy((this.desiredAccuracy === enums.Accuracy.high) ? android.location.Criteria.ACCURACY_FINE : android.location.Criteria.ACCURACY_COARSE);
-
if (options) {
if (options.desiredAccuracy) {
this.desiredAccuracy = options.desiredAccuracy;
@@ -127,15 +138,17 @@ export class LocationManager {
this.updateDistance = options.updateDistance;
}
if (options.minimumUpdateTime) {
- this.minimumUpdateTime = options.minimumUpdateTime;
+ this.androidLocationManager.minimumUpdateTime = options.minimumUpdateTime;
}
}
+ criteria.setAccuracy((this.desiredAccuracy === enums.Accuracy.high) ? android.location.Criteria.ACCURACY_FINE : android.location.Criteria.ACCURACY_COARSE);
this.locationListener._onLocation = onLocation;
this.locationListener._onError = onError;
this.locationListener.maximumAge = (options && ("number" === typeof options.maximumAge)) ? options.maximumAge : undefined;
try {
- this.androidLocationManager.requestLocationUpdates(long(this.minimumUpdateTime), float(this.updateDistance), criteria, this.locationListener, null);
+ this.androidLocationManager.manager.requestLocationUpdates(this.androidLocationManager.minimumUpdateTime, this.updateDistance, criteria, this.locationListener, null);
+ this.isStarted = true;
}
catch (e) {
if (onError) {
@@ -145,21 +158,22 @@ export class LocationManager {
}
public stopLocationMonitoring() {
- this.androidLocationManager.removeUpdates(this.locationListener);
+ this.androidLocationManager.manager.removeUpdates(this.locationListener);
+ this.isStarted = false;
}
get lastKnownLocation(): locationModule.Location {
var criteria = new android.location.Criteria();
criteria.setAccuracy((this.desiredAccuracy === enums.Accuracy.high) ? android.location.Criteria.ACCURACY_FINE : android.location.Criteria.ACCURACY_COARSE);
try {
- var providers = this.androidLocationManager.getProviders(criteria, false);
+ var providers = this.androidLocationManager.manager.getProviders(criteria, false);
var it = providers.iterator();
var location: android.location.Location;
var tempLocation: android.location.Location;
while (it.hasNext()) {
var element = it.next();
//console.log('found provider: ' + element);
- tempLocation = this.androidLocationManager.getLastKnownLocation(element);
+ tempLocation = this.androidLocationManager.manager.getLastKnownLocation(element);
if (!location) {
location = tempLocation;
}
@@ -179,4 +193,25 @@ export class LocationManager {
return null;
}
+}
+
+export class AndroidLocationManager implements locationModule.AndroidLocationManager {
+ private _manager: android.location.LocationManager;
+ private _minimumUpdateTime: number;
+
+ public set minimumUpdateTime(value: number) {
+ this._minimumUpdateTime = value;
+ }
+
+ public get minimumUpdateTime(): number {
+ return this._minimumUpdateTime;
+ }
+
+ public get manager(): android.location.LocationManager {
+ return this._manager;
+ }
+
+ constructor(manager: android.location.LocationManager) {
+ this._manager = manager;
+ }
}
\ No newline at end of file
diff --git a/location/location.d.ts b/location/location.d.ts
index c45ddc5ce..72c521e8f 100644
--- a/location/location.d.ts
+++ b/location/location.d.ts
@@ -121,11 +121,6 @@ declare module "location" {
*/
updateDistance: number;
- /**
- * The minimum time interval between subsequent location updates, in milliseconds (ignored on iOS).
- */
- minimumUpdateTime: number;
-
/**
* True if the location listener is already started. In this case all other start requests will be ignored.
*/
@@ -148,13 +143,49 @@ declare module "location" {
* Returns last known location from device's location services or null of no known last location.
*/
lastKnownLocation: Location;
+
+ /**
+ * An android-specific data for location.
+ */
+ android: AndroidLocationManager;
+
+ /**
+ * An ios-specific data for location.
+ */
+ ios: iOSLocationManager;
}
- /**
- * Fires a single shot location search. If you specify timeout in options, location search will fail on timeout.
- * If you specify timeout = 0 it just requests the last known location.
- * However if you specify maximumAge and the location received is older it won't be received.
- * @param options An optional object specifying location update settings.
- */
+ /**
+ * Provides Android specific data related to location.
+ */
+ export interface AndroidLocationManager {
+ /**
+ * The android-specific location manager [LocationManager](http://developer.android.com/reference/android/location/LocationManager.html)
+ */
+ manager: android.location.LocationManager;
+
+ /**
+ * The minimum time interval between subsequent location updates, in milliseconds.
+ */
+ minimumUpdateTime: number;
+ }
+
+ /**
+ * Fires a single shot location search. If you specify timeout in options (milliseconds), location search will stop on timeout.
+ * If you specify timeout = 0 it just requests the last known location.
+ * However if you specify maximumAge and the location received is older it won't be received.
+ * @param options - An optional object specifying location update settings.
+ */
export function getLocation(options?: Options): Promise;
+
+ /* tslint:disable */
+ /**
+ * Provides iOS specific data related to location.
+ */
+ export interface iOSLocationManager {
+ /**
+ * The ios-specific location manager [CLLocationManager](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/)
+ */
+ manager: CLLocationManager;
+ }
}
\ No newline at end of file
diff --git a/location/location-manager.ios.ts b/location/location.ios.ts
similarity index 76%
rename from location/location-manager.ios.ts
rename to location/location.ios.ts
index 14e98abe8..e172ffa41 100644
--- a/location/location-manager.ios.ts
+++ b/location/location.ios.ts
@@ -1,5 +1,10 @@
import enums = require("ui/enums");
import locationModule = require("location");
+import common = require("location/location-common");
+
+import merger = require("utils/module-merge");
+declare var exports;
+merger.merge(common, exports);
class LocationListenerImpl extends NSObject implements CLLocationManagerDelegate {
public static ObjCProtocols = [CLLocationManagerDelegate];
@@ -44,22 +49,30 @@ class LocationListenerImpl extends NSObject implements CLLocationManagerDelegate
}
public locationManagerDidFailWithError(manager, error): void {
- // console.error('location error received ' + error.localizedDescription);
if (this._onError) {
this._onError(new Error(error.localizedDescription));
}
}
}
-export class LocationManager {
+export class LocationManager implements locationModule.LocationManager {
+ get android(): locationModule.AndroidLocationManager {
+ return undefined;
+ }
+
+ get ios(): locationModule.iOSLocationManager {
+ return this.iosLocationManager;
+ }
+
+ public isStarted: boolean;
// in meters
// we might need some predefined values here like 'any' and 'high'
public desiredAccuracy: number;
- // The minimum distance (measured in meters) a device must move horizontally before an update event is generated.
+ // The minimum distance (measured in meters) a device must move horizontally before an update event is generated.
public updateDistance: number;
- private iosLocationManager: CLLocationManager;
+ private iosLocationManager: locationModule.iOSLocationManager;
private listener: any;
public static _locationFromCLLocation(clLocation: CLLocation): locationModule.Location {
@@ -71,9 +84,9 @@ export class LocationManager {
location.verticalAccuracy = clLocation.verticalAccuracy;
location.speed = clLocation.speed;
location.direction = clLocation.course;
- location.timestamp = new Date(clLocation.timestamp.timeIntervalSince1970 * 1000);
+ var timeIntervalSince1970 = NSDate.dateWithTimeIntervalSinceDate(0, clLocation.timestamp).timeIntervalSince1970;
+ location.timestamp = new Date(timeIntervalSince1970 * 1000);
location.ios = clLocation;
- //console.dump(location);
return location;
}
@@ -110,9 +123,11 @@ export class LocationManager {
}
constructor() {
+ //super();
this.desiredAccuracy = enums.Accuracy.any;
this.updateDistance = kCLDistanceFilterNone;
- this.iosLocationManager = new CLLocationManager();
+ var iosLocManager = new CLLocationManager();
+ this.iosLocationManager = new iOSLocationManager(iosLocManager);
}
public startLocationMonitoring(onLocation: (location: locationModule.Location) => any, onError?: (error: Error) => any, options?: locationModule.Options) {
@@ -127,24 +142,39 @@ export class LocationManager {
}
this.listener = LocationListenerImpl.new().initWithLocationErrorOptions(onLocation, onError, options);
- this.iosLocationManager.delegate = this.listener;
- this.iosLocationManager.desiredAccuracy = this.desiredAccuracy;
- this.iosLocationManager.distanceFilter = this.updateDistance;
- this.iosLocationManager.startUpdatingLocation();
+ this.iosLocationManager.manager.delegate = this.listener;
+ this.iosLocationManager.manager.desiredAccuracy = this.desiredAccuracy;
+ this.iosLocationManager.manager.distanceFilter = this.updateDistance;
+ this.iosLocationManager.manager.startUpdatingLocation();
+ this.isStarted = true;
}
}
public stopLocationMonitoring() {
- this.iosLocationManager.stopUpdatingLocation();
- this.iosLocationManager.delegate = null;
+ this.iosLocationManager.manager.stopUpdatingLocation();
+ this.iosLocationManager.manager.delegate = null;
this.listener = null;
+ this.isStarted = false;
}
get lastKnownLocation(): locationModule.Location {
- var clLocation = this.iosLocationManager.location;
+ var clLocation = this.iosLocationManager.manager.location;
if (clLocation) {
return LocationManager._locationFromCLLocation(clLocation);
}
return null;
}
+}
+
+/* tslint:disable */
+export class iOSLocationManager implements locationModule.iOSLocationManager {
+ private _manager: CLLocationManager;
+
+ public get manager(): CLLocationManager {
+ return this._manager;
+ }
+
+ constructor(manager: CLLocationManager) {
+ this._manager = manager;
+ }
}
\ No newline at end of file