Hi,
I am usin location service for getting latitude and longitude of my location.While running my program it will give me wrong latitude and longitude.How can i get my current location details accurately? Is there any settings in mobile /device ?
String locationProvider = LocationManager.GPS_PROVIDER;
if(!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER )) {
locationProvider = LocationManager.NETWORK_PROVIDER;
}
Log.w(TAG,"CurrentLocProvider :"+locationProvider);
location=locationManager.getLastKnownLocation(locationProvider);
Log.i(TAG,"Location :"+location);
if(location!=null){
Log.i(TAG,"Location Lat :"+location.getLatitude());
latitude = Double.toString(location.getLatitude());
longitude = Double.toString(location.getLongitude());
txtView.append("\nLatitude : "+latitude+"\n Longitude : "+longitude);
}
After some time
public void onLocationChanged(Location location) {
Log.i(TAG,"Lat :"+location.getLatitude();
Log.i(TAG,"Long :"+location.getLongitude();
}
Also giving me wrong location.Some times USA,In another device china.In Different device it is giving different results? How can i get the currect result?
Thanks, aare.