Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Contributor
Posts: 3
Registered: ‎02-18-2010
My Device: Bold
My Carrier: att

Blackberry and GPS functionalites

I am developing an application for BB (OS v4.2) and need to add some GPS functionalites such as:


a. Latitude
b. Longitude
c. Satellite date/time (UTC)
d. Speed
e. Number of satellites locked
f. Heading


I found a way to retrieve the Latitude, Longitude, Speed and Heading. Is that possible to get the Satelite date/time and Number os satelites locked?




Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: Blackberry and GPS functionalites

You can call getExtraInfo on a location object to get the additional data you're looking for -


In particular, the $GPGGA string mentioned in the javadoc contains the satellite date/time and number of satellites locked.

Andrew Cowart | Metova
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Blackberry and GPS functionalites

Number of satellites locked is actually an integer stored in the Location object. I can't find out how to access it, but it's there.


As for date/time, the only way I could find to get it is the following:



    // Date/Time ----------------------------------------
    Calendar calender = Calendar.getInstance();
    String dateTime = (calender.getTime ()).toString () + " ";
    //Format = "Wed Feb 03 20:45:31 GMT 2010"


You can use the String.substring method to extract the specific pieces and store them. For example:



//Time - Hours
GPSBytes [13] = (byte) (Integer.parseInt (dateTime.substring (11,13)));


There's also Location.getTimestamp, but it returns the number of milliseconds since January first, 12:00:00 am, 1970. Accurate, but difficult to work with.


Note: Java doesn't have a switch/case that uses Strings, so you'll have to manually create an if statement for each month to enumerate them.



Hope that helps,



chown -R us ./base