Retrieve location information updates
You can associate only one
LocationListener object with a specific wireless service provider of GPS location information. The
BlackBerry® device application typically listens for updates on a separate thread.
- Import the following classes:
- javax.microedition.location.Criteria
- javax.microedition.location.LocationProvider
- Import the LocationListener
interface.
- Implement the LocationListener
interface.
- Create an instance of a Criteria object.
- Invoke LocationProvider.getInstance() using the Criteria object as a parameter
and assign the value that the method returns to a LocationProvider variable.
LocationProvider provider = LocationProvider.getInstance(criteria);
- Invoke LocationProvider.setLocationListener() using an instance of the class that implements the LocationListener interface as a parameter to register the implementation.
provider.setLocationListener(loclistener, 9, -1, -1);
Was this information helpful? Send us your comments.