Hey everybody!
I'm looking for a possibility to get the current Speed from GPS in a WRT-Widget.
Is this possible anyway?
David from Germany
Hey everybody!
I'm looking for a possibility to get the current Speed from GPS in a WRT-Widget.
Is this possible anyway?
David from Germany
Last edited by .david.; 2010-02-17 at 08:43.
Hey, I've now found a code to get the HorizontalSpeed from GPS.
Well longitude and latitude works fine but the speed doesn't work, it shows always "undefined" or "NaN".
Here's my code:
So have anybody any idea why the speed never works?var lat = 0; //aktuelle eigene Position
var lon = 0;
var speed = 0;
var GPS_av = 0;
var locationService = device.getServiceObject("Service.Location", "ILocation");
if (widget.isrotationsupported) widget.setDisplayPortrait(); //Hochformat
window.menu.hideSoftkeys(); //Fullscreen
function startGPS()
{
criteria = new Object();
criteria.LocationInformationClass = "GenericLocationInfo";
criteria.Updateoptions = new Object();
criteria.Updateoptions.UpdateInterval = 1000000; //1 sek.
criteria.Updateoptions.UpdateTimeOut = 15000000; //15 sek.
criteria.Updateoptions.UpdateMaxAge = 0;
criteria.Updateoptions.PartialUpdates = false;
result = locationService.ILocation.Trace(criteria, handleGPS);
}
function handleGPS(transId, eventCode, result){ //GPS-Daten verarbeiten, wird jede Sekunde ausgeführt
if (eventCode != 4) { //GPS bestimmt
GPS_av = 1;
lon = result.ReturnValue.Longitude;
lat = result.ReturnValue.Latitude;
speed = result.ReturnValue.HorizontalSpeed;
document.getElementById('lon').innerHTML = lon;
document.getElementById('lat').innerHTML = lat;
document.getElementById('speed').innerHTML = speed;
sendGPS(lon, lat, speed);
}
else alert("GPS-Tracking Error");
}
function getSpeed(){
document.getElementById('lon').innerHTML = lon;
document.getElementById('lat').innerHTML = lat;
document.getElementById('speed').innerHTML = speed;
}
And I've got an other Problem, a friend developed a WRT-Widget which needs GPS, he tested on his N97, now he tested on a N86, on the N97 the device asks if the widget is allowed to use GPS, but on the N86 the widget never asks to use GPS, so GPS doesn't work, also the N86 never prints an error or something else.
I hope you can understand what i want to explain ...
Sorry for my bad school English from Germany ...
David
Last edited by .david.; 2010-02-17 at 08:36.
Sorry for double Post, but have nobody an idea why i don't get a speed?
Greetings
David
Hi David,
I'm having the same problem with my E71 trying to get speed and course from within a midlet.
I have read that setting the criteria.setSpeedAndCourseRequired(true); would do the trick. But that did not work for me. Anybody out there, who can assure, that the E71 GPS speed and course values are accessible via Java?