2010-11-08 1 views
0

assez clair fromt le titre, jusqu'à présent, je l'ai essayé différentes coordonnées mais voici un exemple de ce qui se passe:android geo fixent coordonnées diffère des réellement lu

telnet localhost <port> 
Trying ::1... 
Trying 127.0.0.1... 
Connected to localhost. 
Escape character is '^]'. 
Android Console: type 'help' for a list of commands 
OK 
geo fix 46.498981 11.350230 
OK 

alors que dans le logcat j'ai trouvé ce couple:

46.491002 11.351833366666664 

quand je donne cette coordonnée je lis dans le logcat de mon écouteur d'emplacement classe implémentant (et d'autres pour une double vérification):

public class LocationService implements LocationListener { 
private static final String TAG = "LocationService"; 
public LocationManager lmr = null; 
private Navigation SystemService = null; 

public LocationService(Navigation sservice) { 
    this.SystemService = sservice; 
} 

public void startLocationService() { 
    Log.d(TAG, "starting LocationService"); 
    this.lmr = (LocationManager) this.SystemService 
      .getSystemService(Context.LOCATION_SERVICE); 
    this.lmr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 5, 
      this); 
} 

public void stopLocationService() { 
    this.lmr.removeUpdates(this); 
} 

/* 
* (non-Javadoc) 
* 
* @see 
* android.location.LocationListener#onLocationChanged(android.location. 
* Location) 
*/ 
@Override 
public void onLocationChanged(Location location) { 
    location = this.lmr.getLastKnownLocation(LocationManager.GPS_PROVIDER); 
    try { 
    // this code is used to make a location used from the server I am communicating with out of a android.location 
     eu.fbk.dycapo.models.Location loc = new eu.fbk.dycapo.models.Location(); 
     Log.d(TAG, "longitude : " + location.getLongitude()); 
     Log.d(TAG, "latitude : " + location.getLatitude()); 
     loc.setGeorss_point(String.valueOf((double) location.getLongitude()) 
       + " " + String.valueOf((double) location.getLatitude())); 
     loc.setLeaves(Calendar.getInstance().getTime()); 
     loc.setPoint(eu.fbk.dycapo.models.Location.POSI); 
    //send it to the server 
     LocationService.updatePosition(loc); 

    } catch (NullPointerException e) { 
     Log.e(TAG, e.getMessage()); 
     e.printStackTrace(); 
    } 

} 

/* 
* (non-Javadoc) 
* 
* @see 
* android.location.LocationListener#onProviderDisabled(java.lang.String) 
*/ 
@Override 
public void onProviderDisabled(String provider) { 
    // TODO Auto-generated method stub 

} 

/* 
* (non-Javadoc) 
* 
* @see 
* android.location.LocationListener#onProviderEnabled(java.lang.String) 
*/ 
@Override 
public void onProviderEnabled(String provider) { 
    // TODO Auto-generated method stub 

} 

/* 
* (non-Javadoc) 
* 
* @see android.location.LocationListener#onStatusChanged(java.lang.String, 
* int, android.os.Bundle) 
*/ 
@Override 
public void onStatusChanged(String provider, int status, Bundle extras) { 
    // TODO Auto-generated method stub 

} 

Je pense qu'il y a peut-être quelque chose qui ne va pas, mais je ne comprends pas où et pourquoi, puisque j'ai suivi les directives android pour implémenter les écouteurs de localisation here.
grâce

Répondre

1

Il est un bug connu dans l'émulateur, j'ai peur, voir:

link text

I (et bien d'autres) ont le même problème.

+0

merci je vise également un avd 1.6. Juste pour être sûr que cela fonctionnera sur un vrai appareil, ou devrais-je passer à> = 2.0? – urobo

+0

Apparemment, cela fonctionne bien sur les appareils réels selon d'autres affiches. Tout aussi bien, comme si vous marchiez près d'une falaise dans le brouillard et que vous utilisiez l'appareil, cela pourrait être difficile. Il s'agit probablement des dernières versions du plugin ADT, cela fonctionne correctement avec 0.9.6. Je suis sur 0.9.9 et ce n'est pas vraiment pratique d'y retourner. – NickT

Questions connexes