08-06-2008 09:43 AM
The JavaScript Location only delivers coordinates from the GPS if the location was updated one time, i. e. if the coordinates change one time. This means that if a user does not change its location he cannot request his current position and this makes the JavaScript Location useless in most cases.
Is it possible to activate the GPS or the JavaScript Location without changing the position?
In the new BlackBerry Browser v4.6 on the simulator the locationupdate event used in blackberry.location.onLocationUpdate(var method) is fired every two or three seconds and you can only stop it by closing the emulator. Is this a bug in your beta version?
Thank you very much.
08-08-2008 10:19 AM
The onLocationUpdate method fires when the location updates, but you can also request an update or check the current location by accessing blackberry.location.longitude and blackberry.location.latitude. The following knowledge base article explains this further.
What Is - JavaScript methods to use location-based services
Article Number: DB-00450
The onLocationUpdate method should only fire when the location has actually changed.
08-08-2008 11:37 AM
Hello,
thank you very much for your reply.
MSohm wrote:
The following knowledge base article explains this further.
What Is - JavaScript methods to use location-based services
Article Number: DB-00450
This knowledge base article is well known.
MSohm wrote:
The onLocationUpdate method should only fire when the location has actually changed.
This seems to be the issue which I have described in my question: If the page loads in a users browser the location does not change because the user does not change his position and latitude and longitude are 0. The same if I call blackberry.location.latitude and blackberry.location.longitude without refresh or onLocation Update.
08-12-2008 02:08 PM
08-15-2008 01:53 PM
ttklf4 wrote:In the new BlackBerry Browser v4.6 on the simulator the locationupdate event used in blackberry.location.onLocationUpdate(var method) is fired every two or three seconds and you can only stop it by closing the emulator. Is this a bug in your beta version?
4.1 on the 8800 does the same thing. I have found several issues with the GPS location javascript documentation. In my testing onLocationUpdate gets call even if the location doesn't change. Even if it did it should be called at least once when the lat/long get changed from 0 to the correct value. you can add something like this in you onLocationUpdate to take care of it being called multiple times:
var gotUpdate = false; function locationCallback() { if (!(gotUpdate))
{
//do stuff with blackberry.location.latitude
gotUpdate = true;
}
}
More info from my testing can be found here: http://www.tonybunce.com/2008/05/08/BlackberryBrowserAmpGPS.aspx
10-09-2008 12:28 PM
Hello Tony,
thank you very much for your reply.
I had already implemented your suggested solution to stop onLocationUpdate. The BlackBerry Browser 4.6 has a new method called removeLocationUpdate to remove the callback function.
But I am not sure if JavaScript location will always work on a real device. In all my emulators I only get coordinates when I change the location.
If you are interested in you can try my application with your BlackBerry under:
http://ttklf4.tempw8.internet1.de/m/New1/Search.as
10-16-2008 05:47 PM
Hi tony,
I tried exactly the way you have tried but the OnLocationUpdate method is never called. But the refreshLocation method return true.
10-17-2008 04:04 PM
03-09-2009 08:50 AM
hi tried to get the syntax but i am getting this error LocationTracker.java:64: expected UiApplication.getUiApplication().(new Runnable() ^ 1 error please can you tell me what seems to be the problem the thing is, i donot have much knowledge bout thread handling,
so troubling u with silly questions.
regards.
03-25-2009 03:29 PM