I have a mobile app for which I want to use geolocation. My problem is that I don't understand how to assign the lat / lon to a property in Application.js so I can bind other pages to it.
When I bind the position to a latLon property in Application.js is get: 004930 Assertion error! position is not an data (qx.event.type.Data) event on qx.bom.GeoLocation[99-0].: Expected 'qx.event.type.Data' but found 'qx.event.type.GeoPosition'!
I have tried some variations, but I just can't bind to the property.
I got it working so far that I can debug the location:
var loginPage = new sgmobile.page.Login();
manager.addDetail(loginPage);
loginPage.addListener("appear", function(evvt) {
this.__getPosition();
}, this);
loginPage.show();
................
__getPosition : function() {
var geoLocation = qx.bom.GeoLocation.getInstance();
var pos = geoLocation.getCurrentPosition();
geoLocation.addListener("position", this.__applyPosition);
},
__applyPosition : function(position) {
this.latlon = {
"lat" : position.getLatitude(),
"lon" : position.getLongitude()
}
this.debug("latlon: " + qx.lang.Json.stringify(this.latlon));
},
I Also copied the mailinglist.
Best Regards, Alex
The data binding requires a data event to be bindable. As the GeoLocation event is not a data event, It is by default not bindable. If you want to have that bound, I would suggest to add the properties to your application you want to bind and connect these properties by hand with the geolocation events using event listeners.