Android telnet localhost 5554

时间:2012-01-08 19:41:55

标签: android gps telnet

我通过telnet对Android GPS模拟有一点问题。因此,当我尝试使用“telnet localhost 5554”命令连接到Android设备时,它会显示以下消息,而我的应用程序无法从telnet获取gps数据:

telnet localhost 5554
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
geo fix 32.234234 39.234234
OK

我的应用程序从telnet获取GPS数据,如下所示:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mapView = (MapView)findViewById(R.id.mapView);
        mapController = mapView.getController();

        mapView.setStreetView(true);
        mapView.setBuiltInZoomControls(true);

        mapController.setZoom(13);

        positionOverlay = new MyPositionOverlay();
        overlays = mapView.getOverlays();
        overlays.add(positionOverlay);

        String context = Context.LOCATION_SERVICE;
        locationManager = (LocationManager)getSystemService(context);

        location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

        userID="1";
        connect("http://10.0.2.2:8080/acil/gen/rest/user/"+userID+"/"+location.getLatitude()+"/"+location.getLongitude()+"/son");

        updateWithNewLocation(location);

        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,    
                MINIMUM_UPDATE_INTERVAL, MINIMUM_UPDATE_DISTANCE,
                locationListener);

}

有什么问题?或者还有其他更有效的方式来提供gps数据吗?

0 个答案:

没有答案