maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   N900 & access Location API from Javascript ? (https://talk.maemo.org/showthread.php?t=38821)

kakoskin 2009-12-30 17:09

N900 & access Location API from Javascript ?
 
Hi,

Is there any way to get GPS location using Javascript in N900 browser ? I have heard that I could be possible but some plugin needs to be installed first. I would like to use the location on my ajax web page.

jak 2009-12-30 17:14

Re: N900 & access Location API from Javascript ?
 
Quote:

Originally Posted by kakoskin (Post 446855)
Hi,

Is there any way to get GPS location using Javascript in N900 browser ? I have heard that I could be possible but some plugin needs to be installed first. I would like to use the location on my ajax web page.


I guess looking at http://dev.w3.org/geo/api/spec-source.html and https://developer.mozilla.org/en/using_geolocation should help. You need to install the maemo-geolocation package.

kakoskin 2009-12-30 17:21

Re: N900 & access Location API from Javascript ?
 
Thank you!

Does this mean that I need to use Firefox and it's not possible with the built-in browser that ships with N900 ?

jackburton 2009-12-30 18:16

Re: N900 & access Location API from Javascript ?
 
Check out maeMaps (search this site) for an example application that uses the plugin.

The plugin works with the built-in browser.

Here is a post:
http://talk.maemo.org/showthread.php...hlight=maemaps

onutz 2009-12-30 19:07

Re: N900 & access Location API from Javascript ?
 
also try this: install greasemonkey plugin then maemo geolocation plugin; then you are able to use gmaps quite easy

jak 2009-12-30 22:52

Re: N900 & access Location API from Javascript ?
 
Quote:

Originally Posted by kakoskin (Post 446877)
Thank you!

Does this mean that I need to use Firefox and it's not possible with the built-in browser that ships with N900 ?

The N900 browser is based on Firefox code, it uses the Gecko engine just like Firefox does. And the API itself is a completely browser-independent W3C Standard Draft.

kakoskin 2009-12-31 14:59

Re: N900 & access Location API from Javascript ?
 
Some status update for those who are trying similar stuff.

I installed Firefox Mobile on my N900 and then Maemo GeoLocation add-on (https://addons.mozilla.org/en-US/mobile/addon/46819), works pretty ok, you can test it at:
http://geo.webvm.net/

This configuration does not enable geolocation in N900 default browser however.

nikul.padhya 2010-08-03 16:57

Re: N900 & access Location API from Javascript ?
 
Quote:

Originally Posted by kakoskin (Post 446855)
Hi,

Is there any way to get GPS location using Javascript in N900 browser ? I have heard that I could be possible but some plugin needs to be installed first. I would like to use the location on my ajax web page.

Hey you can also check
www.narrativecolors.com/map.html for javascript example.

also here is the code

----------------------XXXX------------------

function getMyLocation(){
if(navigator.geolocation) { // Try Browser's Geolocation
browserSupportFlag = true;
navigator.geolocation.getCurrentPosition(function( position) {
initialLocation = new google.maps.LatLng(position.coords.latitude,positi on.coords.longitude);
map.setCenter(initialLocation);
}, function() { handleNoGeolocation(browserSupportFlag); });
} else if (google.gears) { // Try Google Gears Geolocation
browserSupportFlag = true;
var geo = google.gears.factory.create('beta.geolocation');
geo.getCurrentPosition(function(position) {
initialLocation = new google.maps.LatLng(position.latitude,position.long itude);
map.setCenter(initialLocation);
}, function() { handleNoGeoLocation(browserSupportFlag); });
} else { // Browser doesn't support Geolocation
browserSupportFlag = false;
handleNoGeolocation(browserSupportFlag);
}
function handleNoGeolocation(errorFlag) {
if (errorFlag == true) {
alert("Geolocation service failed.");
} else {
alert("Your browser doesn't support geolocation !!");
}
}
var image = new google.maps.MarkerImage(
'images/iamhere.png', new google.maps.Size(48,48),
new google.maps.Point(0,0),
new google.maps.Point(24,48)
);

marker = new google.maps.Marker({ map: map, position: initialLocation, icon: image, title:"We are Here !! "});
}


-----------#### HOPE it works -------

Geekworld 2010-09-11 00:12

Re: N900 & access Location API from Javascript ?
 
Quote:

Originally Posted by jak (Post 447304)
The N900 browser is based on Firefox code, it uses the Gecko engine just like Firefox does. And the API itself is a completely browser-independent W3C Standard Draft.

Is solution fr this?


All times are GMT. The time now is 02:37.

vBulletin® Version 3.8.8