Class Info |
|---|
public class ActivityIdentificationResponse implements Parcelable, IMessageEntity Activity identification result. |
Qualifier and Type | Field and Description |
|---|---|
static final Creator<ActivityIdentificationResponse> | Used to deserialize the activity identification result. |
Constructor Name |
|---|
ActivityIdentificationResponse() Builds an ActivityIdentificationResponse instance. |
ActivityIdentificationResponse(ActivityIdentificationData mostActivityIdentificationData, long time, long elapsedTimeFromReboot) Builds an ActivityIdentificationResponse instance. |
ActivityIdentificationResponse(List<ActivityIdentificationData> activityIdentificationDatas, long time, long elapsedTimeFromReboot) Builds an ActivityIdentificationResponse instance. |
Qualifier and Type | Method Name and Description |
|---|---|
static boolean | containDataFromIntent(Intent intent) Checks whether the intent contains ActivityIdentificationResponse. If yes, this method will return true. |
getActivityIdentificationDatas() Obtains a list of identified activities. | |
int | getActivityPossibility(int activityType) Obtains the confidence of the specified activity type. |
static ActivityIdentificationResponse | getDataFromIntent(Intent intent) Obtains ActivityIdentificationResponse from extras of the intent sent by the activity identification service. |
long | Obtains the number of milliseconds elapsed since the device boot time to the identification result trigger time. |
getMostActivityIdentification() Obtains the most possible activity for the user behavior. | |
long | getTime() Obtains the number of milliseconds elapsed since 00:00:00 on January 1, 1970 to the identification result trigger time. |
void | setElapsedTimeFromReboot(long elapsedTimeFromReboot) Sets the number of milliseconds elapsed since the device boot time to the identification result trigger time. |
void | setTime(long time) Sets the number of milliseconds elapsed since 00:00:00 on January 1, 1970 to the identification result trigger time. |
Fields |
|---|
public static final Creator<ActivityIdentificationResponse> CREATOR Used to deserialize the activity identification result. |
Constructor |
|---|
public ActivityIdentificationResponse() Builds an ActivityIdentificationResponse instance. |
Constructor |
|---|
public ActivityIdentificationResponse(ActivityIdentificationData mostActivityIdentificationData, long time, long elapsedTimeFromReboot) Builds an ActivityIdentificationResponse instance. |
Parameters
Name | Description |
|---|---|
mostActivityIdentificationData | Most possible activity identified in the period. |
time | Number of milliseconds elapsed since 00:00:00 on January 1, 1970. |
elapsedTimeFromReboot | Number of milliseconds elapsed since the device boot time to the identification result trigger time. |
Constructor |
|---|
public ActivityIdentificationResponse(List<ActivityIdentificationData> activityIdentificationDatas, long time, long elapsedTimeFromReboot) Builds an ActivityIdentificationResponse instance. |
Parameters
Name | Description |
|---|---|
activityIdentificationDatas | List of all identified activities in the period, which are sorted by confidence. |
time | Number of milliseconds elapsed since 00:00:00 on January 1, 1970. |
elapsedTimeFromReboot | Number of nanoseconds elapsed since the device boot time to the identification result trigger time. |
Method |
|---|
public static boolean containDataFromIntent(Intent intent) Checks whether the intent contains ActivityIdentificationResponse. If yes, this method will return true. This is a utility function that can be called inside an intent receiver to ensure that the received intent is from the activity identification service. |
Parameters
Name | Description |
|---|---|
intent | Intent sent by the activity identification service. |
Returns
Type | Description |
|---|---|
boolean | true if the intent contains ActivityIdentificationResponse; false otherwise. |
Method |
|---|
public List<ActivityIdentificationData> getActivityIdentificationDatas() Obtains a list of identified activities. These activities are sorted by confidence in descending order. The sum of the confidences of all detected activities returned by this method may be greater than 100 because some activities are not mutually exclusive. |
Returns
Type | Description |
|---|---|
List of identified activities. |
Method |
|---|
public int getActivityPossibility(int activityType) Obtains the confidence of the specified activity type. |
Parameters
Name | Description |
|---|---|
activityType | Activity type. For details, please refer to Constant Values. |
Returns
Type | Description |
|---|---|
int | Confidence. |
Method |
|---|
public static ActivityIdentificationResponse getDataFromIntent(Intent intent) Obtains ActivityIdentificationResponse from extras of the intent sent by the activity identification service. |
Parameters
Name | Description |
|---|---|
intent | Intent sent by the activity identification service. |
Returns
Type | Description |
|---|---|
ActivityIdentificationResponse | If the intent does not contain ActivityIdentificationResponse, null will be returned. |
Method |
|---|
public long getElapsedTimeFromReboot() Obtains the number of milliseconds elapsed since the device boot time to the identification result trigger time using SystemClock.elapsedRealtime(). |
Returns
Type | Description |
|---|---|
long | Timestamp, in milliseconds. |
Method |
|---|
public ActivityIdentificationData getMostActivityIdentification() Obtains the most possible activity for the user behavior. |
Returns
Type | Description |
|---|---|
Most possible activity for the user behavior. |
Method |
|---|
public long getTime() Obtains the number of milliseconds elapsed since 00:00:00 on January 1, 1970 to the identification result trigger time using System.currentTimeMillis(). |
Returns
Type | Description |
|---|---|
long | Timestamp, in milliseconds. |