public final class API
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
API.TaskType |
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
authAccountAction |
java.lang.String |
batteryThresholdAction |
java.lang.String |
checkinIntervalAction |
java.lang.String |
dataUsageAction |
static int |
INVALID_PRIORITY |
static java.lang.String |
SERVER_RESULT_ACTION |
java.lang.String |
taskStatusAction |
static int |
USER_PRIORITY |
java.lang.String |
userResultAction
Action name of different type of result for broadcast receiver.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelTask(java.lang.String taskId)
Cancel the task submitted to the scheduler
|
java.lang.Object |
clone() |
com.mobilyzer.MeasurementTask |
composeTasks(API.TaskType manner,
java.util.Date startTime,
java.util.Date endTime,
double intervalSec,
long count,
long priority,
int contextIntervalSec,
java.util.Map<java.lang.String,java.lang.String> params,
java.util.ArrayList<com.mobilyzer.MeasurementTask> taskList)
Create a parallel or sequential task based on the manner.
|
com.mobilyzer.MeasurementTask |
createTask(API.TaskType taskType,
java.util.Date startTime,
java.util.Date endTime,
double intervalSec,
long count,
long priority,
int contextIntervalSec,
java.util.Map<java.lang.String,java.lang.String> params)
Create a new MeasurementTask based on those parameters.
|
static API |
getAPI(Context parent,
java.lang.String clientKey)
Actual method to get the singleton API object
|
void |
getAuthenticateAccount()
Get current authenticate account used by scheduler
|
void |
getBatteryThreshold()
Get current battery threshold of the scheduler.
|
void |
getCheckinInterval()
Get current checkin interval of the scheduler.
|
void |
getDataUsage()
Get current data usage of the scheduler.
|
static java.util.Set<java.lang.String> |
getMeasurementNames()
Gets the currently available measurement descriptions
|
void |
getTaskStatus(java.lang.String taskId)
Get current status of that task.
|
static java.lang.String |
getTypeForMeasurementName(java.lang.String name)
Get the type of a measurement based on its name.
|
void |
setAuthenticateAccount(java.lang.String account)
Set authenticate account for uploading results.
|
void |
setBatteryThreshold(int threshold)
Set battery threshold of the scheduler.
|
void |
setCheckinInterval(long interval)
Set checkin interval of the scheduler.
|
void |
setDataUsage(com.mobilyzer.MeasurementScheduler.DataUsageProfile profile)
Set data usage profile of the scheduler.
|
void |
startAndBindService()
Bind to scheduler, automatically called when the API is initialized
|
void |
submitTask(com.mobilyzer.MeasurementTask task)
Submit task to the scheduler.
|
void |
unbind()
Unbind from scheduler, called in activity's onDestroy callback function
|
public java.lang.String userResultAction
public static final java.lang.String SERVER_RESULT_ACTION
public java.lang.String batteryThresholdAction
public java.lang.String checkinIntervalAction
public java.lang.String taskStatusAction
public java.lang.String dataUsageAction
public java.lang.String authAccountAction
public static final int USER_PRIORITY
public static final int INVALID_PRIORITY
public static API getAPI(Context parent, java.lang.String clientKey)
parent - Context which the object lies inclientKey - User-defined unique key for this applicationpublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic void startAndBindService()
public void unbind()
public com.mobilyzer.MeasurementTask createTask(API.TaskType taskType, java.util.Date startTime, java.util.Date endTime, double intervalSec, long count, long priority, int contextIntervalSec, java.util.Map<java.lang.String,java.lang.String> params) throws com.mobilyzer.exceptions.MeasurementError
taskType - Type of measurement (ping, dns, traceroute, etc.) for this
measurement task.startTime - Earliest time that measurements can be taken using this
Task descriptor. The current time will be used in place of a null
startTime parameter. Measurements with a startTime more than 24
hours from now will NOT be run.endTime - Latest time that measurements can be taken using this Task
descriptor. Tasks with an endTime before startTime will be canceled.
Corresponding to the 24-hour rule in startTime, tasks with endTime
later than 24 hours from now will be assigned a new endTime that
ends 24 hours from now.intervalSec - Minimum number of seconds to elapse between consecutive
measurements taken with this description.count - Maximum number of times that a measurement should be taken
with this description. A count of 0 means to continue the
measurement indefinitely (until end_time).priority - Two level of priority: USER_PRIORITY for user task and
INVALID_PRIORITY for server taskcontextIntervalSec - interval between the context collection (in sec)params - Measurement parameters.com.mobilyzer.exceptions.MeasurementError - taskType is not validpublic com.mobilyzer.MeasurementTask composeTasks(API.TaskType manner, java.util.Date startTime, java.util.Date endTime, double intervalSec, long count, long priority, int contextIntervalSec, java.util.Map<java.lang.String,java.lang.String> params, java.util.ArrayList<com.mobilyzer.MeasurementTask> taskList) throws com.mobilyzer.exceptions.MeasurementError
manner - Determine whether tasks in task list will be executed
parallelly or sequentially (back-to-back)startTime - Earliest time that measurements can be taken using this
Task descriptor. The current time will be used in place of a null
startTime parameter. Measurements with a startTime more than 24
hours from now will NOT be run.endTime - Latest time that measurements can be taken using this Task
descriptor. Tasks with an endTime before startTime will be canceled.
Corresponding to the 24-hour rule in startTime, tasks with endTime
later than 24 hours from now will be assigned a new endTime that
ends 24 hours from now.intervalSec - Minimum number of seconds to elapse between consecutive
measurements taken with this description.count - Maximum number of times that a measurement should be taken
with this description. A count of 0 means to continue the
measurement indefinitely (until end_time).priority - Two level of priority: USER_PRIORITY for user task and
INVALID_PRIORITY for server taskcontextIntervalSec - interval between the context collection (in sec)params - Measurement parameters.taskList - tasks to be executedcom.mobilyzer.exceptions.MeasurementError - manner is not validpublic void submitTask(com.mobilyzer.MeasurementTask task)
throws com.mobilyzer.exceptions.MeasurementError
task - the task to be exectued, created by createTask(..)
or composeTask(..)com.mobilyzer.exceptions.MeasurementErrorpublic void cancelTask(java.lang.String taskId)
throws com.mobilyzer.exceptions.MeasurementError
localId - task to be cancelled. Got by MeasurementTask.getTaskId()java.security.InvalidParameterExceptioncom.mobilyzer.exceptions.MeasurementErrorpublic void setAuthenticateAccount(java.lang.String account)
throws com.mobilyzer.exceptions.MeasurementError
account - com.mobilyzer.exceptions.MeasurementErrorpublic void getAuthenticateAccount()
throws com.mobilyzer.exceptions.MeasurementError
com.mobilyzer.exceptions.MeasurementErrorpublic void setBatteryThreshold(int threshold)
throws com.mobilyzer.exceptions.MeasurementError
threshold - new battery threshold, must stay between 0 and 100com.mobilyzer.exceptions.MeasurementErrorpublic void getBatteryThreshold()
throws com.mobilyzer.exceptions.MeasurementError
com.mobilyzer.exceptions.MeasurementErrorpublic void setCheckinInterval(long interval)
throws com.mobilyzer.exceptions.MeasurementError
interval - new checkin interval, should be greater than min intervalcom.mobilyzer.exceptions.MeasurementErrorpublic void getCheckinInterval()
throws com.mobilyzer.exceptions.MeasurementError
com.mobilyzer.exceptions.MeasurementErrorpublic void getTaskStatus(java.lang.String taskId)
throws com.mobilyzer.exceptions.MeasurementError
taskId - the id of the target taskcom.mobilyzer.exceptions.MeasurementErrorpublic void setDataUsage(com.mobilyzer.MeasurementScheduler.DataUsageProfile profile)
throws com.mobilyzer.exceptions.MeasurementError
profile - new data usage profilecom.mobilyzer.exceptions.MeasurementErrorpublic void getDataUsage()
throws com.mobilyzer.exceptions.MeasurementError
com.mobilyzer.exceptions.MeasurementErrorpublic static java.util.Set<java.lang.String> getMeasurementNames()
public static java.lang.String getTypeForMeasurementName(java.lang.String name)