我要做的就是从最后一个知道的位置返回长/纬度值,如果那是空的,那么拉新的坐标。
我对此很陌生,这就是我所拥有的:
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;
public class GPS extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double longitude = location.getLongitude();
double latitude = location.getLatitude();
TextView output;
output = (TextView) findViewById(R.id.output);
output.append("\n\nLocations (starting with last known):");
Location location = locationManager.getLastKnownLocation(bestProvider);
printLocation(location);
}
}