Class PollingService
java.lang.Object
com.exxothermic.audioeverywheresdk.helper.logic.PollingService
Class which wraps a polling service
- Since:
- 12/11/13
-
Constructor Summary
ConstructorsConstructorDescriptionPollingService
(android.content.Context context, long timeInterval) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
Method which force a poll actionint
long
getId()
Getter for the polling service id which is the unix timestamp upon the object's creationint
boolean
Getter to identify if the polling service is runningboolean
Getter which indicates if the polling service is performing the update operation on backgroundabstract void
Abstract method which is intended to execute the polling operation logicvoid
Method which schedules a polling event.void
setCurrentDeviceType
(int mCurrentDeviceType) void
setResponseHandler
(AudioEverywhereResponseHandler responseHandler) Method that will set the current response handler for this polling service cyclevoid
start()
Method which starts the polling servicevoid
stop()
Method which stops the polling service
-
Constructor Details
-
PollingService
public PollingService(android.content.Context context, long timeInterval) Default constructor- Parameters:
context
- The application's contexttimeInterval
- the time interval for this polling
-
-
Method Details
-
getId
public long getId()Getter for the polling service id which is the unix timestamp upon the object's creation- Returns:
- The polling service id
-
isRunning
public boolean isRunning()Getter to identify if the polling service is running- Returns:
- A boolean indicating if the polling service is running
-
isUpdating
public boolean isUpdating()Getter which indicates if the polling service is performing the update operation on background- Returns:
- A boolean indicating if the polling service is performing the update operation on background
-
setResponseHandler
Method that will set the current response handler for this polling service cycle- Parameters:
responseHandler
- the response handler to set
-
getResponseHandler
-
start
public void start()Method which starts the polling service -
forcePolling
public void forcePolling()Method which force a poll action -
stop
public void stop()Method which stops the polling service -
pollInBackground
public abstract void pollInBackground()Abstract method which is intended to execute the polling operation logic -
scheduleNextPoll
public void scheduleNextPoll()Method which schedules a polling event. Likewise updates the current interval considering an exponential backoff algorithm, if the previous poll was not useful the current interval should increment, if it was useful the current increment should be reset to the min interval -
getCurrentDeviceType
public int getCurrentDeviceType() -
getmCurrentDeviceType
public int getmCurrentDeviceType() -
setCurrentDeviceType
public void setCurrentDeviceType(int mCurrentDeviceType)
-