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){
onLocationChanged(location);
} 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
}
waitForGpsFix(GPSFIX_DELAY);
}
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.
Regards
There was previously a bug where
LocationManager.NETWORK_PROVIDER
returned null, which may still be returned by thelocationManager.getBestProvider()
method. This should be fixed in the newer OS builds, however.If you'd like to fix your code immediately, all you would need to do would be to set:
as in the early stages,
GPS_PROVIDER
was the only provider that was implemented in the player.