views:

53

answers:

2

I want to retrieve location data (latitude and longitude) from symbian phone with its web browser with getlocation api. Is there anyway I can do it? any api to recommend to get location data from gps enabled symbian devices? Thanks!!

A: 

You may want to check out the open source geo-location-javascript JavaScript wrapper. Using it is as easy as this:

if (geo_position_js.init()){
  geo_position_js.getCurrentPosition(function (p) {
    alert(p.coords.latitude.toFixed(2) + ', ' + p.coords.longitude.toFixed(2));
  },  
  function (p) {
    alert('Error: ' + p.code);
  });
}
else {
  alert('Handset does not have client-side geolocation capabilities');
}

This wrapper was also discussed on Dive into HTML 5.

Daniel Vassallo
@daniel I have tried that api on nokia device but it didnt work. Apparently this api will only work in app, but not through the browser. You can get this work? How? Thanks.
limfreak
@limfreak: Unfortunately I don't have a nokia handset to test it with. As far as I know, Nokia does not implement the W3C Geolocation API yet, and it has it's own API. This wrapper should be consolidating the different APIs into a single one... I'll leave the answer here for a while, just in case some else can comment, or test it... If it doesn't work, I'll delete it :)
Daniel Vassallo
+2  A: 

I would recommend checking out phonegap http://www.phonegap.com They have a geolocation api, but I don't know which versions of Symbian that support it. Also look into APIbridge on forum.nokia.com.

Nota that whether this is possible may depend very much on the version of Symbian you are targeting.

Ola