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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 17
Registered: ‎08-06-2012
My Device: Curve 9320
My Carrier: Vodaphone

Location info Not displaying in device



I was testing the Blackberry sample application. The GPS app. It works in simulation. But in device (Blackberry curve 9320, Bold 9900) the same app doesn't show the latitude and longitude info.


I have checked the Location settings to 'On' in device.


Please help.



Sanghamitra Pati

Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Location info Not displaying in device

Did your device get a gps fix? It won't if it is indoors, try it on a window maybe.

Otherwise this should cover the basics:
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Super Contributor
Posts: 278
Registered: ‎11-04-2010
My Device: 4.5 and above
My Carrier: none

Re: Location info Not displaying in device



Please check this,


import javax.microedition.location.LocationProvider;
import javax.microedition.location.LocationListener;
import javax.microedition.location.Location;
import javax.microedition.location.LocationException;
import javax.microedition.location.Criteria;

public class GetLocationDetails {
    private ListnerInterface callback;
    private LocationProvider provider,_locationProvider;
    private double longitude=0.0,lattitude=0.0;
    private Criteria criteria;  
    private float Altitude = 0;
    private float Speed  = 0;
    private float Accuracy = 0;
    public GetLocationDetails(ListnerInterface callback) {  
        this.callback = callback; 
    public class LocationListenerImpl implements LocationListener {
            public void locationUpdated(LocationProvider provider, final Location location) {
                //System.out.println("---Location Updated-----");
                if (location.isValid()) {
                    //System.out.println("---Location Valid----");
                    longitude = location.getQualifiedCoordinates().getLongitude();
                    lattitude = location.getQualifiedCoordinates().getLatitude();
                    Altitude = location.getQualifiedCoordinates().getAltitude();
                    Speed  = location.getSpeed();
                    Accuracy = location.getQualifiedCoordinates().getHorizontalAccuracy();
                    //System.out.println("Lattitude :-=============================="+lattitude);
                    //System.out.println("Longitude :-=============================="+longitude);
                    _locationProvider.setLocationListener(null, 0, 0, 0);
                    callback.ListnerNotify(Double.toString(lattitude), Double.toString(longitude), Float.toString(Altitude), Float.toString(Speed), Float.toString(Accuracy), LBF_Constants.SUCCESS);
                    //System.out.println("else NOT valid--Cellsite valide=-----");
                    //System.out.println("---Location Not Valid----");
                    //callback.ListnerNotify(null, null, null, null, null, LBF_Constants.FAILURE);
            public void providerStateChanged(LocationProvider provider, int newState) {
        private void setupCriteria() {
            criteria = new Criteria();
        private void setupProvider() {
            try {
                try {
                } catch (Throwable e) {
                provider = LocationProvider.getInstance(criteria);
                        new LocationListenerImpl(), 1, 1, 1);
            } catch (Throwable t) {
                callback.ListnerNotify(null, null, null, null, null, LBF_Constants.FAILURE);
        public void startLocationUpdate()  {
                _locationProvider = LocationProvider.getInstance(null);
                if (_locationProvider != null) {
                            new LocationListenerImpl(), 1, 1, 1);
                }else {
                    String msg = "GPS does not support. You won't receive notifications on this device.";
                    callback.ListnerNotify(null, null, null, null, null, msg);
            }catch(LocationException le) {
                System.out.println("----Exception Of Location--"+le);
                callback.ListnerNotify(null, null, null, null, null, LBF_Constants.FAILURE);

 callback.listnerNotify is for sending the result to place where you want..




Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Location info Not displaying in device

Rather than just pasting in code, I recommend that you review the KB article Simon has pointed you at.


If you do want to paste in code, then I recommend this: