0

I have recently posted a question regarding getting the user location which I thought I had solved using geolocation.GeoLocationProvider. However, I am having strange behaviour on different devices. On an iphone 5s, I get the most accurate and smallest circle marking my position. On a galaxy S3 I get very large circles and takes long to connect. I then connected a Nexus to my mobile over bluetooth and shared 3G internet. Funnily enough, my position was not showing at all. In all 3 cases, I tried going into bing maps and google maps and they all have shown my position very accurately. Is there anything I am skipping for this discrepancy between my code and bing/google maps' code?

Thanks you all, Justin

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
  • Could you share the code where you try to retrieve your position? – Nicolas Boonaert Mar 14 '14 at 09:44
  • yes Nicolas, will do so tonight! Thanks for your reply – Justin Farrugia Mar 17 '14 at 09:52
  • var geoLocationProvider = new Microsoft.Maps.GeoLocationProvider(map); geoLocationProvider.getCurrentPosition(locateSuccess, locateFail);and in locateSuccess...userLocation = new Microsoft.Maps.Location(loc.coords.latitude, loc.coords.longitude); map.entities.push(userLocation); – Justin Farrugia Mar 18 '14 at 22:00

1 Answers1

0

The Bing Maps site uses the same functionality. All this does is wrap the different web based geolocation API's for different browsers into one easy to use class. This method pulls the location from the browser built-in geolocation functionality (older browsers had several different ways of doing this). This will make use of a GPS device if it has access (small circle), fall back to WIFI or IP address (large circles). A couple of things worth checking, if this is being used in an app, have you enabled access to the geolocation sensors? If this is being used in as a web app through the browser, did you get a prompt to allow access to your location and did you press Allow? If the device isn't able to access the GPS and it's using share WIFI from another phone I could see how this might confuse things.

Another option is to use the HTML5 geolocation API: http://www.w3schools.com/HTML/html5_geolocation.asp

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
  • To answer your questions and put you more in my shoes...Yes i did turn on the GPS sensors and triple checked this. The web app shows small circles but if I turn on the option 'use GPS only' nothing appears. I did get the prompt and chose Allow. Strangely enough, google maps locates my position immediately from the google maps website and big maps does not. Bing maps does get my location after a number of tries though. And yes I did try to use navigator.geo.... and nothing worked at all. Atm I'm using GeoLocationProvider. This is extremely frustrating – Justin Farrugia Mar 18 '14 at 21:56