Retrieve the course of the BlackBerry device, in degrees
- Import the following classes:
- javax.microedition.location.LocationProvider
- javax.microedition.location.Location
- Create an instance of a LocationProvider.
LocationProvider provider = new LocationProvider();
- Invoke LocationProvider.getLocation() and assign the value that the method returns to a Location variable.
Location mylocation = provider.getLocation(-1);
- Invoke location.getCourse() and save the value that the method returns to a float variable.
float course = mylocation.getCourse();
Was this information helpful? Send us your comments.