PDA

View Full Version : PhoneGap(1.2.0)+GoogleMap+Ext.util.GeoLocation



won.rhee
16 Dec 2011, 5:05 PM
This is driving me crazy... Same code works just fine on web browser but does not disconnect gps location calls when used with PhoneGap.

So basic controller code :



index: function(options) {
if(!this.listPanel){
this.listPanel = this.render({
xtype:'LocationsListView'
});
}
this.application.viewport.setActiveItem(this.listPanel, {type:'fade'});
this.geo = new Ext.util.GeoLocation({
//tried all sorts of stuff in here
autoUpdate: false,
allowHighAccuracy: true,
maximumAge: 1000,
timeout: 5000
});
this.geo.on('locationupdate', this.onGeoUpdate, this);
this.geo.on('locationerror', this.onGeoFail, this);
this.geo.updateLocation();
},


So given above config, current location call should timeout at 5 seconds. It never does. I always see that GPS mark on top-right of iPhone. Never goes away, iPhone becomes very sluggish.

It is ok to use Ext.util.Geolcation with PhoneGap for getting gps locations, right?
Any thoughts on this???

mitchellsimoens
17 Dec 2011, 7:46 AM
Ext.util.GeoLocation uses the HTML5 spec for getting geolocation. If PhoneGap doesn't like this, you may have to see if they have a plugin or something to use.

won.rhee
20 Dec 2011, 11:17 AM
Ext.util.GeoLocation uses the HTML5 spec for getting geolocation. If PhoneGap doesn't like this, you may have to see if they have a plugin or something to use.

I've used navigator.geolocation.stop()

This will stop gps locations calls when used with phonegap.

http://groups.google.com/group/phonegap/browse_thread/thread/58f7ff98170b16c4/ca2c90ed9a6d9dfb?lnk=gst&q=geolocation#ca2c90ed9a6d9dfb