Maintain a connection with GPS satellites

You can configure a BlackBerry® device application to query the Location API for GPS location information in an interval that is less than 10 seconds.
  1. Import the following classes:
    • javax.microedition.location.Criteria
    • javax.microedition.location.LocationProvider
  2. Import the LocationListener interface.
  3. Implement the LocationListener interface.
  4. Create an instance of the Criteria class.
    Criteria criteria = new Criteria();
  5. 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);
    
  6. Invoke LocationProvider.setLocationListener() to configure a LocationListener with an interval value that is less than 10 seconds.
    provider.setLocationListener(loclistener, 9, -1, -1);
    

Was this information helpful? Send us your comments.