com.veriplace.client
Class PollingAPI

java.lang.Object
  extended by com.veriplace.client.PollingAPI

public class PollingAPI
extends java.lang.Object

Interface for querying user location changes in bulk, using a version of the Simple Update Protocol. To access an instance of this class, use Client.getPollingAPI().

For applications that wish to receive location updates at regular intervals, consider using PollingManager, which calls PollingAPI from a background thread and pushes the results to a listener.

Since:
2.4
See Also:
Veriplace Developer Guide: Using the Polling API

Method Summary
 int getPeriodSeconds()
           
 Location getUpdateLocation(LocationUpdateReference update, Token accessToken, java.lang.Integer timeout)
          Retrieves information about a specific location update.
 LocationUpdates getUpdates(java.lang.Integer timeout)
          Retrieves information about recent location updates for all users that this application can locate, using the client's application-specific access token.
 LocationUpdates getUpdates(Token accessToken, java.lang.Integer timeout)
          Retrieves information about recent location updates for all users that this application can locate, specifying the application access token.
 void setPeriodSeconds(int periodSeconds)
          Specifies the interval, in seconds, between updates to the location change list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPeriodSeconds

public int getPeriodSeconds()

setPeriodSeconds

public void setPeriodSeconds(int periodSeconds)
Specifies the interval, in seconds, between updates to the location change list. If zero or negative, the Veriplace server will use its default interval (60 seconds).


getUpdates

public LocationUpdates getUpdates(java.lang.Integer timeout)
                           throws UnexpectedException
Retrieves information about recent location updates for all users that this application can locate, using the client's application-specific access token.

Parameters:
timeout - the maximum number of seconds to wait, or null for no timeout
Returns:
a LocationUpdates object containing the query results
Throws:
UnexpectedException - if there was an unexpected OAuth error or I/O error

getUpdates

public LocationUpdates getUpdates(Token accessToken,
                                  java.lang.Integer timeout)
                           throws UnexpectedException
Retrieves information about recent location updates for all users that this application can locate, specifying the application access token.

Parameters:
timeout - the maximum number of seconds to wait, or null for no timeout
Returns:
a LocationUpdates object containing the query results
Throws:
UnexpectedException - if there was an unexpected OAuth error or I/O error

getUpdateLocation

public Location getUpdateLocation(LocationUpdateReference update,
                                  Token accessToken,
                                  java.lang.Integer timeout)
                           throws GetLocationNotPermittedException,
                                  PositionFailureException,
                                  UnexpectedException
Retrieves information about a specific location update.

Parameters:
update - a LocationUpdateReference object returned by a previous call to getUpdates(java.lang.Integer)
accessToken - an access token permitting the user to be located
timeout - the maximum number of seconds to wait, or null for no timeout
Returns:
the location data
Throws:
PositionFailureException - if the result of this location update was an error
GetLocationNotPermittedException - if the access token does not allow getting locations for this user
UnexpectedException - if there was an unexpected OAuth error or I/O error