// Acquire a reference to the system Location Manager
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
makeUseOfNewLocation(location);
}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
};
// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
<http://developer.android.com/guide/topics/location/obtaining-user-location.html>에서 삽입
'Android' 카테고리의 다른 글
Android intent - Application 호출 (0) | 2012.07.29 |
---|---|
android : spinner 사용방법 (0) | 2012.07.29 |
안드로이드 dialog 사용방법 (0) | 2012.07.29 |
안드로이드 어플리케이션 백그라운드에서 사용 (0) | 2012.07.29 |
Conversion to Dalvik format failed with error (0) | 2012.07.29 |