03-10-2010 05:55 PM
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 (v18.104.22.1681)
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.
03-15-2010 01:23 PM
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)?
03-15-2010 02:15 PM
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.