Ich verwende Android 2.3.1 Projekt, um einen aktuellen Standort mit Hilfe von LocationManager.GPS_PROVIDER zu erhalten.Android: Warum schlägt native_start in startNavigating() auf Android 2.3.1 Emulator fehl?
Dies ist mein Code
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager locManager = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
LocationListener locListener = new BTILocationListener();
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);
}
public class BTILocationListener implements LocationListener {
@Override
public void onLocationChanged(Location loc) {
Log.d("BTILocation", "Inside onLocationChanged() ---");
if (loc != null) {
double latitude = loc.getLatitude();
double longitude = loc.getLongitude();
String locationstr = "Latitude = " + latitude + " longitude = " +longitude;
Log.d("BTILocation", locationstr);
}
}
@Override
public void onProviderDisabled(String provider) {
Toast.makeText(getApplicationContext(), "GPS Disabled", Toast.LENGTH_SHORT).show();
Log.w("BTILocation", "GPS is Disabled");
}
@Override
public void onProviderEnabled(String provider) {
Toast.makeText(getApplicationContext(), "GPS Enabled", Toast.LENGTH_SHORT).show();
Log.w("BTILocation", "GPS is Enabled");
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
}
Der Berechtigungssatz Ich benutze -
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
Ich benutze offene Telnet-Verbindung
telnet localhost 5544
geo fix 12 22
ich folgende Fehler auf logcat sehen -
E/GpsLocationProvider( 75): native_start failed in startNavigating()
Das in onLocationChanged (loc loc) zurückgegebene location-Objekt ist unter 2.3.1 immer null.
Der gleiche Code funktioniert gut in Android 2.1 und 4.0. Bitte helfen Sie mir, dieses Problem zu lösen, ich habe Google-Suche versucht, aber ich konnte die Lösung nirgends finden. Vielen Dank! Ich habe keine Google APIs, die mit Android API Level 7 kompatibel sind, weiß jemand, wie ich es herunterladen kann?
das ist wirklich komisch. – coredump
Weitere Probleme - https://groups.google.com/forum/?fromgroups=#!topic/adt-dev/Z8NKJKyVmts – satyajit