私はEclipse用のAndroidエミュレーターを使用しようとしています。telnet とエミュレータ ddms の両方を使用して、エミュレータのジオ ポイントを設定しました。
何らかの理由で、エミュレータから自分の場所を取得しようとすると、常に 0,0 が返されます。適切な場所から提供されていない可能性があります。エミュレータで使用する必要があるプロバイダはどれですか?
これは私のコードです:
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
location = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location == null) {
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location == null) {
Toast.makeText(
this,
"Couldn't get your location, map will be unavailable",
8000).show();
}
else
{
app.setLatitude((int) (location.getLatitude() * 1E6));
app.setLongitude((int) (location.getLongitude() * 1E6));
}
} else {
app.setLatitude((int) (location.getLatitude() * 1E6));
app.setLongitude((int) (location.getLongitude() * 1E6));
}