展开全部
记得我前几天发过一个类似的代码如下(适用安卓)32313133353236313431303231363533e78988e69d8331333337383836import android.app.Activity;
import android.os.Bundle;
import android.location.*;
import android.content.*;
import android.util.Log;
import android.widget.TextView;
public class GPSLocationListenActivity extends Activity implements LocationListener {
LocationManager locman;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
locman = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
}
@Override
protected void onResume(){
if (locman != null){
locman.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0,this);
<