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

Android™ Development

New Contributor
Posts: 6
Registered: ‎03-19-2013
My Device: Blackberry Z10
My Carrier: Rogers

GPS Location

Hi all,


My app has been ported from Android to blackberry and it works fine...


the only thing not working is the GPS location which works on the android....


the app displays a message to the using that we are trying to find the location and if no location is found we tell the user that we could not retrieve a location..


here is the code

private void gpsLocation()
             //Get the location manager
             locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
             //Provide Criteria
              Criteria criteria = new Criteria();
             provider = locationManager.getBestProvider(criteria, false);
              Location location = locationManager.getLastKnownLocation(provider);
             locationManager.requestLocationUpdates(provider, 400, 1, this);
             if(location != null){
              } else{
                     Log.i(TAG, "no GPS location available - waiting for GPS fix");
                     Toast.makeText(getApplicationContext(), R.string.gpsWaitingToast, Toast.LENGTH_SHORT).show();
                    if (Debug.GPS_USE_MONTREAL) {
                          currentLatitude = Double.valueOf(Debug.GPS_LAT_MONTREAL); currentLongitude = Double.valueOf(Debug.GPS_LNG_MONTREAL); // montreal

 its not working,, I restarted the app ,, did it next to a window and all that stuff..


nothing works..


your advise and help is greatly appreciated.