我正在尝试创建一个应用程序,通过gps获取用户位置,在谷歌地图中显示用户位置,然后在一定的时间/移动后更新.
我现在有一个应用程序,将通过GPS获取用户的位置,并更新自己每10米/ 10,000毫秒,但目前它是所有显示什么坐标.我已将其设置为连接到谷歌地图,但此刻它只是将地图设置为我手动输入的一些坐标.
如何获取它以便地图将根据通过gps获得的坐标显示位置?
任何帮助将不胜感激,我对这一切都很新!
编辑:到目前为止我的代码!
package com.android.basicmap;
import com.google.android.maps.MapActivity;
import android.os.Bundle;
import com.google.android.maps.MapView;
import com.google.android.maps.MapController;
import com.google.android.maps.GeoPoint;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
public class BasicMapActivity extends MapActivity {
private MapView mapView;
private MapController mapController;
private LocationManager locationManager;
private LocationListener locationListener;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationListener = new GPSLocationListener();
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0,
0,
locationListener);
mapView = (MapView) findViewById(R.id.mapView);
mapView.setStreetView(true);
mapView.setBuiltInZoomControls(true); …Run Code Online (Sandbox Code Playgroud)