Retrieve the location information for a BlackBerry device

  1. Import the following classes:
    • javax.microedition.location.LocationProvider
    • javax.microedition.location.Location
  2. Create an instance of a LocationProvider.
    LocationProvider provider = new LocationProvider();
  3. In a non-event thread, invoke LocationProvider.getLocation(int), providing a timeout, in seconds.
    try {
    Location location = provider.getLocation(-1);
    } catch (Exception e) {
    
    }
    

Was this information helpful? Send us your comments.