안녕하세요?

안드로이드 땜에 오늘도 씨름을 하고 있습니다. 기존에 개발되어 있던 앱이 장애인의 경로를 tracing해서 서버로 전송하도록 되어있습니다. 문제는 location이 정확하게 측정되다가 어느 순간에 영 엉뚱한 지역으로 나오고 있습니다.  제가 지금 시드니 근교에 있는데 NSW 중간 쯤으로 나오기도 하고 그러네요. 한국으로 치자면 서울에 있는데 대전이나 전라도로 나오는 꼴입니다.
이것 때문에 다른 스탭들이 어메이징하게 생각하고 있습니다.

소스코드는 이렇습니다. (맥이라서 그런가요? 소스코드 하일라이터로 파일이 안올라가지네요)

public class LocationMonitor extends Service implements LocationListener,Runnable {
...
    Object locationUpdateNotifier= null;
    public static GeoPoint ourLocation;

    
public void synchronize()
{
if(ourLocation == null)
{
ourLocation = getLastKnownLocation();
if(ourLocation == null) return;
}
//Load last time we synced
long lastSyncTime = some_value;
if(lastSyncTime < System.currentTimeMillis()  - UPDATE_FREQ)  //UPDATE_FREQ - default 30 minutes
{
handler.post(new Runnable() {
public void run() {
GpsPingTask pingTask = new GpsPingTask(context,String.valueOf(ourLocation.getLatitudeE6()/1E6),String.valueOf(ourLocation.getLongitudeE6()/1E6));
pingTask.execute((Void)null); //Send location to server
}
});
       lastSyncTime =  System.currentTimeMillis();
    //Save new lastSync time 
}
}
public void kill()
{
if(locationManager !=null)
locationManager.removeUpdates(this);
}
public void onLocationChanged(Location location) {
try
{
//Read latitude and longitude from location
//Create Geo point so we can get a english street name address
ourLocation = new GeoPoint((int)(location.getLatitude()*1E6),(int)(location.getLongitude()*1E6));
 
       if(locationUpdateNotifier != null)
       {
       synchronized (locationUpdateNotifier) {
        locationUpdateNotifier.notify();
}
       }
       
       if(!doneFirstUpdate)
       {
        doneFirstUpdate =true;
Log.i("LocationMointor", "LocationMonitor.onLocationChanged() done first update at 0 frequency, resetting to normal speed");
        //Set it to update at the requested frequency
        resetLocationUpdatesFreq();
       }
       
       startSynchronizeThread();
   }
catch (Throwable e) {
Log.i("LocationMointor", "LocationMonitor.onLocationChanged(): " + e);
}
}

public void onProviderDisabled(
String provider) {
// TODO Auto-generated method stub
}
    @Override
public void onProviderEnabled(String provider) {}
    @Override
public void onStatusChanged(String provider, int status, Bundle extras) {}

public void setTemporaryLocationUpdateFreq(int pingFreqSecs) {
setTemporaryLocationUpdateFreq(pingFreqSecs, 10);
}
public void setTemporaryLocationUpdateFreq(int pingFreqSecs, int minimumDistanceMeters) {
if(!doneFirstUpdate)
doneFirstUpdate =true;
tempLocationUpdateFreq = pingFreqSecs;
tempLocationUpdateMeters = minimumDistanceMeters;
handler.post(new Runnable()
{
public void run() {
//Turn of location updates
if(locationManager !=null)
locationManager.removeUpdates(locationMonitor);
//Restart  location updates with new frequency
locationManager.requestLocationUpdates(getGpsMode(), UPDATE_FREQ, tempLocationUpdateMeters,locationMonitor);
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, tempLocationUpdateFreq*1000, tempLocationUpdateMeters,locationMonitor);
}
});
}
private void startSynchronizeThread() {
  if(!running)
        new Thread(this).start();
}
public void resetLocationUpdatesFreq() {
locationUpdateNotifier = null;
handler.post(new Runnable()
{
public void run() {
//Turn of location updates
if(locationManager !=null) {
locationManager.removeUpdates(locationMonitor);
//Restart  location updates with default location update frequency
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MINIMUM_TIME_BETWEEN_UPDATE, MINIMUM_DISTANCECHANGE_FOR_UPDATE,locationMonitor);
}
}
});
}
public void setLocationUpdateFreq(int pingFreqMins) {
Log.i("LocationMointor", "LocationMonitor.setLocationUpdateFreq().mode: " + getGpsMode() + "pingFreq:" + pingFreqMins);
//Save new frequency value
SharedPreferences pref = context.getSharedPreferences(PREF_PING_FREQ, Context.MODE_PRIVATE);
Editor prefEditor= pref.edit();
prefEditor.putInt(PREF_PING_FREQ, 10);
prefEditor.commit();
handler.post(new Runnable()
{
public void run() {
//Turn of location updates
if(locationManager !=null)
locationManager.removeUpdates(locationMonitor);
//Restart  location updates with new piong frequency
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MINIMUM_TIME_BETWEEN_UPDATE, MINIMUM_DISTANCECHANGE_FOR_UPDATE,locationMonitor);
}
});
 
}
public void addUpdateNotify(Object notifyable)
{
this.locationUpdateNotifier = notifyable;
}

public GeoPoint getLastKnownLocation()
{
Criteria crit = new Criteria();
//Try get last known fine location
crit.setAccuracy(Criteria.ACCURACY_FINE);
String provider = locationManager.getBestProvider(crit, false);
Location loc = locationManager.getLastKnownLocation(provider);
//If we got no location, try coarse location
if(loc == null)
{
crit.setAccuracy(Criteria.ACCURACY_COARSE);
provider = locationManager.getBestProvider(crit, false);
loc = locationManager.getLastKnownLocation(provider);
//If nothing, return nothing
if(loc == null)
{
Log.i("LocationMointor", "LocationMonitor.getLastKnownLocation() got no location");
return null;
}
}
//Create geopoint and return it.
GeoPoint geoPoint = new GeoPoint((int)(loc.getLatitude()*1E6),(int)(loc.getLongitude()*1E6));
Log.i("LocationMointor", "LocationMonitor.getLastKnownLocation() got "  +geoPoint);
return geoPoint;
}

@Override
public void run() {
running = true;
Object pauser = new Object();
do{
try
{
synchronize();
synchronized(pauser)
{
pauser.wait(UPDATE_FREQ);
}
}
catch(Throwable ex)
{
Log.e("LocationMointor", "LocationMonitor.run() " +ex);
}
}
while(running);
}

public void onCreate() {
super.onCreate();
this.context = this;
this.locationMonitor= this;
handler = new Handler(); 
 
//Get the location manager service
locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);

//Start gps to get our location  
this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, UPDATE_FREQ, this);
}
@Override
public void onDestroy() {
super.onDestroy();
kill();
}
@Override
public IBinder onBind(Intent arg0) {
return mBinder;
} 
private final IBinder mBinder = new MyBinder();

public class MyBinder extends Binder {
public LocationMonitor getService() {
return LocationMonitor.this;
}
}
}


아직 안드로이드에 익숙치 않은 상태라 모르는 것이 참 많습니다. 제가 알고 싶은 것은
1. 폰을 가지고 다니면서 GPS ping 이 제대로 되었는지 로그같은 것을 검증할 수 있는 좋은 방법이 있을까요?
2. 폰을 한자리에 계속 놔두어도 onLocationChange() 이벤트가 먹던데, 이게 정확하게 어떤 기준으로 발생하나요?
3. 위 코드에서 문제가 될만한 부분이 어떤 곳인지 알 수 있을까요? 결국 쓰레드이니까 공유변수인 ourLocation이 문제가 있지않을까 생각도 해보고 있는데, 기본 ping주기가 30분일 때도 문제가 생겼기 때문에 더 잘 모르겠습니다.
도움 주시면 정말 감사하겠습니다.