donalg d
donalg d

Reputation: 194

Accessing GPS on Blackberry using Javascript and sending lat/long values to a server via url

When you obtain the lat/long values from a GPS enabled blackberry device, how do you send those values to a server via a url? By the way, I'm trying to do this in Javascript. "window.location.href=..." works fine on the iphone.

I was thinking something like this would work but it doesn't seem to:

function locationCB() {                                 
    window.location.href="http://www.somewebsite.com/latitude:"+blackberry.location.latitude+"/longitude:"+blackberry.location.longitude;
    return true;
}

if ( window.blackberry && blackberry.location.GPSSupported) {
        blackberry.location.onLocationUpdate("locationCB()");
        blackberry.location.setAidMode(2);
        blackberry.location.refreshLocation();
}

Upvotes: 0

Views: 2592

Answers (2)

Tal
Tal

Reputation: 21

I wish I had a better answer (still looking for it myself). However, what I DO know is that most BlackBerry's don't support JavaScript.

Good news is that it is compatible with Geolocation.

Here's a link for its variables: http://docs.blackberry.com/en/developers/deliverables/11844/Support_for_Gears_APIs_738961_11.jsp

Upvotes: 2

Maksym Gontar
Maksym Gontar

Reputation: 22775

If the problem is to send data to server, try this:

http://www.somewebsite.com/[page with gps gather code]?latitude=[value]&longitude=[value]

See
Using URL Parameters
How to send GPS data using HTTP to your web site

Code to parse url parameters will depend on server platform

ASP.NET Passing Parameters from One Page to Another
how to extract parameter from URL using PHP
Java - Access parameters passed in the URL

Upvotes: 0

Related Questions