Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
03-08-2010 05:27 PM
I've been looking into the Criteria class when instantiating my LocationProvider which in turns registers my LocationListener
I've read this article:
and understand some more about the implementation.
I was curious if its a good practice to have two different criteria objects. One for when the GPS is fixed adn working properly and the other for when the application is waiting for the fix to come back.
I am currently looking :
public void providerStateChanged(final LocationProvider provider, final int newState)
methods for when the state changes.
When i detect a negative GPS state between those two i reset my locationlistener to a higher interval.
Should i also incorporate the above idea with two Criteria classes?
Is this a "Best Practice"?
I want to perserve the battery life but still run for long periods of time (hours)
My current development environment:
BlackBerry JDE Plug-in For Eclpise 220.127.116.11
Blackberry JDE Component Package 18.104.22.168
Blackberry JDE Component Package 22.214.171.124
Blackberry JDE Component Package 126.96.36.199
Blackberry JDE Component Package 188.8.131.52
Blackberry JDE Component Package 184.108.40.206
WIndow XP SP 3
03-09-2010 09:22 AM
If you believe the secondary criteria will allow you to KEEP a tentative GPS fix, then by all means go ahead, but if your secondary criteria is just a placeholder to do nothing while searching for a GPS fix, then I would suggest against it. I think a better plan would be to have a flag to denote whether or not you have a GPS fix, and have your location listener only try to perform its operations if the flag is true. You could periodically try to regain a fix, say at 5-minute intervals, using a background Thread. If you believe this would be too much of a drain, have a counter running that increments each time you try to acquire a fix, and have the Thread stop trying after some set number of tries, then go to sleep for another specified interval before trying again.
That's what I did for my application, anyway, but I'm no expert. Take my advice with a grain of salt.
Hope that helps,
03-09-2010 09:30 AM
i have thought of that solution and seen it in an article somewhere.....
I was just curious if the criteria approach would be any better.
Thanks for your input!