05-08-2012 06:37 PM
Weird one this but I've knocked up a quick little app with a button. When press it goes through a loop 1000 times and console.logs the number so you can see it via web inspector. You can run this as many times as you want without fail and this will complete. Everything works fine until you throw geolocation into the mix.
Basically, when the page loads it sets up the watch (navigator.geolocation.watchPosition). Since I am inside this watch is failing to find my position and is producing an error which is handled by the error callback. As soon as this error is generated however, you rerun the loop code and it fails halfway through and produces "JavaScript execution exceeded timeout" as an error in the web inspector.
Any body seen this?
<!DOCTYPE HTML>
<HTML>
<HEAD>
</HEAD>
<BODY onload="get_pos();">
<P>HELLO</P>
<button onclick="testfunc();">Run</button>
</BODY>
<SCRIPT>
var test='';
function geo_error(error)
{
var errors = {
1: 'Permission denied',
2: 'Position unavailable',
3: 'Request timeout'
};
console.log(error);
navigator.geolocation.clearWatch(test);
}
function get_pos()
{
try
{
test = navigator.geolocation.watchPosition(geo_success, geo_error, {
enableHighAccuracy: true,
maximumAge: 600000,
timeout: 30000
});
}
catch (err)
{
console.log(err);
}
}
function geo_success(position)
{
/*"use strict";*/
try
{
lat = position.coords.latitude;
longitude = position.coords.longitude;
}
catch (err)
{
console.log(err);
}
}
function testfunc(){
alert('step 1');
var keycount=1000;
for (var i=0; i<keycount; i++) {
console.log(i);
}
alert('step 2');
}
</SCRIPT></HTML>
05-16-2012 05:34 AM
<!DOCTYPE HTML>
<HTML>
<HEAD>
</HEAD>
<BODY onload="">
<P>HELLO</P>
<button onclick="get_pos()">Run</button>
</BODY>
<SCRIPT>
function geo_error(error)
{
console.log(error);
}
function get_pos()
{
navigator.geolocation.getCurrentPosition(
geo_success,
geo_error,
{timeout: 5000, enableHighAccuracy: true}
);
setTimeout(get_pos, 10000);
}
function geo_success(position)
{
console.log(new Date()+': '+position.coords.latitude+','+position.coords.lon gitude);
}
</SCRIPT></HTML>
Here's another little test app. If you fire this up and click run, the app will eventually crash out with no error after about ten minutes. Interestingly, if you set "enableHighAccuracy: false" it works fine and never crashes. All these tests use a Curve 9360 on 7.1.
05-18-2012 10:26 AM - edited 05-18-2012 10:28 AM
Same behaviour on a 7.1 9860 device for both of these issues.
05-18-2012 12:35 PM
We have built this same app in Phonegap and it doesn't crash. Begs the question, what is Phonegap doing differently to WebWorks? It was my understanding that Phonegap uses WebWorks SDK, so could it be they use a different API for geolocation?
More investigation going on, but anyone elses feedback would be appreciated.
05-18-2012 01:36 PM
Looking at the Phonegap source, it appears it implements it's own gelocation stuff via Java and doesn't use the browser/webkit HTML5 implementation of gelocation. Therefore, it looks like the browser geolocation stuff is broke and will get it logged on the dev issue tracker.
05-27-2012 12:41 PM
I've got same issue. Did you guys solve it somehow?
05-27-2012 12:47 PM
05-27-2012 04:10 PM
Just to add I've logged on the development issue tracker, but not heard anything yet.
Come on RIM guys we need this to work.
06-21-2012 05:40 AM
Can you provide a link to your tracker?
I got the same problem. I notice it happens only when the device do not find the geolocation: the timeout is somewhat not respected and it still runs.
That cause "Previous instance still running" pop-up even if my app is reality closed, and any webworks app that use geolocation will completly crash when starting geolocation.
06-21-2012 06:05 AM