Location API の使用に問題があります。このコードを使用して、利用可能なプロバイダーのいずれかから場所を取得しようとしています:
//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()+")");
}
}
しかし、エミュレータ コントロール (long: 7.745304、lat: 48.589326 など) で座標を送信している場合、位置データの整数部分のみを取得しています (long 7.0、lat 48.0 など)。したがって、これらの値の計算方法は完全に false です。 .
これらのデータの小数部分が失われるのはなぜですか?