I have recently written an abstraction to the Location API that simplifies getting location fixes in different modes, as well as optimizes battery usage. Developers intending to quickly incorporate location technology to their apps can now use the Simple Location API to leverage both GPS and Geolocation-based location services in virtually no time.
Besides pure GPS or Geolocation mode, the Simple Location API comes equipped with an OPTIMAL mode that dynamically chooses between the Research In Motion® (RIM®) Locate Services and on-device GPS, depending on availability. Also, since location-based services can be battery intensive if not handled properly, this API optimizes power consumption by adding increasing breathing intervals between retries when location fixes are not available.
The Simple Location API is designed to include the following features:
- Simplified API with a focus on real world use cases.
- An API that leverages on-device GPS and RIM’s Locate Services.
- Dynamically detects available and supported location modes on the device before trying any of them.
- Has the ability to choose the best location mode based on the modes available on the smartphone.
- Built-in retry mechanism with dynamic delay (to save battery) based on a retry factor set by the API user.
- Performs both single and tracking location fixes.
- Simplified events via SimpleLocationListener interface.
- Capable of starting, stopping and restarting tracking sessions in a reliable thread-safe way.
- Designed to eliminate/reduce misuse of the API
There’s definitely room for improvement to the Simple Location API so, keeping that in mind, the source is fully open and can be downloaded here along with a full demo app. Feel free to integrate this in to your app today, and if you are a passionate BlackBerry® app developer, you know the drill – improve and share!