BlackBerry: Retrieve Location Fixes
This article is the second part of a series of articles dealing with location APIs.
We will start where we left off in the previous article, talking about how to retrieve the location fixes. You can retrieve fixes in two ways: single fix or multiple fix.
3. Retrieve Location fixes
Location LocationProvider.getLocation(int timeout);
Where timeout value specifies the maximum time to get the fix. You can set it to -1 to set it as default.
This method is used to get multiple fixes at certain intervals. We need to implement a LocationListener which will receive the fixes every time the location changes.
In our LocationListener implementation we have to specifically implement the LocationUpdated method.
public void locationUpdated(LocationProvider provider, Location location)
After that, we just have to set this listener to our LocationProvider or BlackBerryLocationProvider:
LocationProvider.setLocationListener(LocationListener, interval, timeout, maxAge)
BlackBerryLocationProvider.setLocationListener(LocationListener, interval, timeout, maxAge)