0

私は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));
        }
4

1 に答える 1

0

次のtelnetコマンドを使用して、エミュレータでGPS修正と位置を設定します。

http://developer.android.com/guide/developing/devices/emulator.html#geo

geo <fix|nmea>
于 2012-05-30T16:00:11.103 に答える