Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
br14
Posts: 497
Registered: ‎06-24-2008
My Device: Not Specified

Re: HTML5 GeoLocation Check Interval

[ Edited ]

Haven't really read through all of this, but are you getting threading issues?

 

Read up about how the browsers manage threads. Because only a single thread is used for UI, anything that is interval based has to wait until it receives control.

 

That would explain why navigator.geolocation.watchPosition works ok - because the underlying process is managing threads, whereas navigator.geolocation.getCurrentPosition has to wait until the UI thread has time to process so requests stack up if the thread is busy doing something else, and then are executed all at once (in this case when the thread is no longer suspended).

 

I guess you could reduce the performance drag of navigator.geolocation.watchPosition by setting enableHighAccuracy to false if the battery power is low.

Please use plain text.
New Developer
georgemck
Posts: 34
Registered: ‎12-28-2010
My Device: Red Z10, DevAlpha C, Bold 9900, PlayBook

Re: HTML5 GeoLocation Check Interval

[ Edited ]

 

 

For Cascades, this explains how location works 

https://developer.blackberry.com/cascades/documentation/device_platform/location/settingup.html

 

 

Onward to BBJam Asia 2013!
twitter/github: @georgemck http://www.bbdevla.com
Please use plain text.
Developer
wantoun
Posts: 165
Registered: ‎10-04-2010
My Device: P'9982 & Z10

Re: HTML5 GeoLocation Check Interval

@br14: thanks! I had no idea about this! It kinda sucks, this is the second limitation I'm facing with WebWorks - looks like it's really NOT as similar to Native as BlackBerry is saying!

 

Anyways, I removed the option to let the user set the interval and I'm only letting the user choose the location High Accuracy! The watcher keeps poling locations like crazy (almost once evey 3-4 seconds sometimes - even though I'm not moving!) but it looks like I got no other choice!

 

I'm going to keep this thread open just to see what other insight poeple have on this or if someone manages to find a workaround to poling on interval!

Wadi
Please use plain text.
Developer
br14
Posts: 497
Registered: ‎06-24-2008
My Device: Not Specified

Re: HTML5 GeoLocation Check Interval

Not really a WebWorks limitation - more an ECMA (?) standard. Hence the invention of "Workers". You could check out workers, but I don't think the navigator object (and therefore geolocation services) is available to workers.

Please use plain text.