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

Java Development

New Developer
Posts: 27
Registered: ‎12-31-2008
My Device: Not Specified

LocationListener performs poorly



I'm developing an application that reports its position on a user defined interval. If I define my own timer and use the getLocation method of the LocationProvider my device reports GPS reliably. If however, I use the LocationListener the performance is less than 50% valid fixes. I have read advice from these forums, everything related to GPS in the knowledge base and viewed both videos.

  BlackBerry 9700 on Rogers (v5.0.0.351)
  Outside with a clear view of the sky

  Criteria gpsCriteria = new Criteria();

After several days of testing I have made the following observations.
1)  The device never reports LocationProvider.OUT_OF_SERVICE or LocationProvider.TEMPORARILY_UNAVAILABLE.

2)  I am always able to get a fix using the getLocation method using the above criteria with a timeout of anything greater than 10 seconds. I can get fixes reliably inside and outside.

3)  The performance using LocationListener is poor. No matter what combination of interval and timeout I use I cannot get better than 50% valid fixes. That is, when the locationUpdated method is called it reports a valid fix 50% of the time. In particular, using the criteria above I set the listener as:
 locationProvider.setLocationListener(new LocationHandler(), 10, -1, -1);

The idea was to keep the GPS hot. I've tried intervals of 1 second, 30 seconds and 60 seconds. The performance is always similar.


Does the LocationListener work reliably or am I just doing something wrong?


Is there any reason to use the LocationListener given such poor performance?

Thank you for any guidance.

BlackBerry Development Advisor
Posts: 15,852
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: LocationListener performs poorly

I wasn't able to reproduce this.  Have you tried using the same LocationProvider for the listener and your thread that uses getLocation?  If so, did the results between the 2 differ (listener invalid, while thread was valid)?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Developer
Posts: 27
Registered: ‎12-31-2008
My Device: Not Specified

Re: LocationListener performs poorly

I use the same locationProvider for both the listener and my thread that uses getLocation. So the same locationProvider works well in my thread but not so well in the locationListener.

Trusted Contributor
Posts: 151
Registered: ‎07-20-2010
My Device: Not Specified

Re: LocationListener performs poorly

have you found a solution to this? Thanks