I have an issue using the Location Api. I’m trying to get the Location from any of the provider available, using this code:
//Définir ma localisation
final LocationManager manag = (LocationManager) ActivityRechercheConcession.this.getSystemService(Context.LOCATION_SERVICE);
//Choix du service de localisation en fonction de critères
Criteria crit = new Criteria();
crit.setCostAllowed(false);
crit.setAccuracy(1000); //précis à au moins 1km pret
final String choix_source = manag.getBestProvider(crit, true);
//demander la position courante
manag.requestLocationUpdates(choix_source, 10000, 0, new LocationListener(){
//Lors de la capture de la position
public void onLocationChanged(Location location) {
Log.i("LocationListener","New position from "+choix_source+": ("+location.getLatitude()+","+location.getLongitude()+")");
}
}
But when I’m sending coordinate with the Emulator Control (like long: 7.745304, lat : 48.589326)
I’m only getting the integer part in my Location data (like long 7.0, lat 48.0)
So calculation method on those value are totally false.
Why do I lose the fractional part of those data?
The problem was coming from Eclipse’s Emulator Control and not from the code.
Some to resolve it I have to rightly configure the eclipse.ini by adding this line:
corresponding to my locale so I used :
and afterwards I had to use “coma” instead of “dot” in value I sended.
That way the code is running well 😀