Retrieve the time that a BlackBerry device application retrieved GPS information
- 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.getTimeStamp() and assign the value that the method returns to a long variable. The time is retrieved from the GPS receiver on the BlackBerry® device.
long timestamp = myLocation.getTimeStamp();
Was this information helpful? Send us your comments.