What does location.getAccuracy() return? I recall having an issue, although I think it might have just been with the Network location provider, where it just flat out would not return a location and IIRC getAccuracy returned -1.
On Dec 3, 10:35 am, "RS.Giridaran" <[email protected]> wrote: > Hi All, > > I am developing an application which uses the current location of the > user to do some operations. i have used LocationManager and > LocationListener to receive the latitude and longitude values in > onLocationChanged() method. it is perfectly working when i am testing > using emulator control in eclipse. when its accessing from the real > device its not functioning properly. its will give 0, 0 for latitude > ad longitude. > > Here is my code which used to get the current location. > /*Code*/ > public GeoLocationManger(Activity activity) { > LocationManager locationManager = (LocationManager) activity > .getSystemService(Context.LOCATION_SERVICE); > Criteria criteria = new Criteria(); > criteria.setAccuracy(Criteria.ACCURACY_FINE); > List providers = locationManager.getProviders(criteria,true); > if(providers != null && providers.size() >0){ > LocationProvider pro > =locationManager.getProvider(providers.get > (0).toString()); > locationManager.requestLocationUpdates(pro.getName(), > 0, 0, this); > } > else > { > Messages.displayMessageOnUI(GasBuddyConstants.INFO, > "GPS Not Enabled – Update your > settings.", > activity); > } > } > > public void onLocationChanged(Location location) { > this.latitude = location.getLatitude(); > this.longitude = location.getLongitude(); > > } > > /*Code*/ > > is there any settings need to do with phone? > > Please help me to resolve this. > > Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

