public boolean moveTo ( int placeId ) { // make sure the placeId is valid if ( placeId < 0 ) { log . warning ( "Refusing moveTo(): invalid placeId " + placeId + "." ) ; return false ; } // first check to see if our observers are happy with this move request if ( ! mayMoveTo ( placeId , null ) ) { return false ; } // we need to call this both to mark that we're issuing a move request and to check to see // if the last issued request should be considered stale boolean refuse = checkRepeatMove ( ) ; // complain if we're over-writing a pending request if ( _pendingPlaceId != - 1 ) { // if the pending request has been outstanding more than a minute, go ahead and let // this new one through in an attempt to recover from dropped moveTo requests if ( refuse ) { log . warning ( "Refusing moveTo; We have a request outstanding" , "ppid" , _pendingPlaceId , "npid" , placeId ) ; return false ; } else { log . warning ( "Overriding stale moveTo request" , "ppid" , _pendingPlaceId , "npid" , placeId ) ; } } // make a note of our pending place id _pendingPlaceId = placeId ; // issue a moveTo request log . info ( "Issuing moveTo(" + placeId + ")." ) ; _lservice . moveTo ( placeId , new LocationService . MoveListener ( ) { public void moveSucceeded ( PlaceConfig config ) { // handle the successful move didMoveTo ( _pendingPlaceId , config ) ; // and clear out the tracked pending oid _pendingPlaceId = - 1 ; handlePendingForcedMove ( ) ; } public void requestFailed ( String reason ) { // clear out our pending request oid int placeId = _pendingPlaceId ; _pendingPlaceId = - 1 ; log . info ( "moveTo failed" , "pid" , placeId , "reason" , reason ) ; // let our observers know that something has gone horribly awry handleFailure ( placeId , reason ) ; handlePendingForcedMove ( ) ; } } ) ; return true ; }
Requests that this client be moved to the specified place . A request will be made and when the response is received the location observers will be notified of success or failure .