I am creating a location app for Android using sencha 2.3.1 + phonegap 3.3.0 and using geolocation to display a list of destinations sorted by proximity to the user's location. Everything works fine if the network location setting is enabled. But if I turn it off and leave gps only based on location, it will never be detected. The code is very simple, I tried and the sencha path:
Ext.device.Geolocation.watchPosition({ frequency: 10000, callback: function(position) { AppHelper.setCurrentLocation(position);
and telephone way:
var success = function(position) { AppHelper.setCurrentLocation(position); }; var fail = function() { AppHelper.setLocationModeOff(); }; navigator.geolocation.watchPosition(success, fail,{ timeout: 30000 });
The result is the same, I tried to wait a couple of minutes for geolocation, but no signs of the location service.
A phone card placement plugin is installed, the correct permissions are installed, and everything works if the network location is enabled.
I am testing a Sony Tablet S.
I know about this error: How to get GPS user position in Sencha But I checked the code and it is definitely fixed in sencha 2.3.1
I would try other devices, but I was wondering if anyone had experienced the same thing.
TIA.
EDIT: I did an experiment using the standard html5 code on my Android device using the default browser for the system (based on web kit). I would gain access to my settings page and change the settings every time I start.
Access to http://html5demos.com/geo I get the following:
I started the device with a network connection and a gps shutdown: I get a message that asks if I want to share my location. I say yes, only this time everything is working fine.
Disable network geolocation, gps is still off: Unable to locate. (as was expected)
Turn GPS on, leave network geolocation off: Geolocation fails, I do not receive a request to use my location and the subsequent activation of a GPS-based GPS installation.
So, my conclusion: this is similar to what I noticed in a telephone bundle. If network geolocation works, everything works as expected. But if I donβt have a network connection and gps works, this is pretty useless in my html5 application.
At least this is what happens on my device (sony tablet)