| CLASS info |
| public class ActivityIdentificationResponse implements Parcelable, IMessageEntity |
| 活动识别结果。 |
| Name | Desc | |
| Creator<ActivityIdentificationResponse> | CREATOR | 用以反序列化活动识别结果。 |
| Constructor name |
| ActivityIdentificationResponse(List<ActivityIdentificationData> activityIdentificationDatas, long time, long elapsedTimeFromReboot) 构建一个ActivityIdentificationResponse实例 |
| ActivityIdentificationResponse(ActivityIdentificationData mostActivityIdentificationData, long time, long elapsedTimeFromReboot) 构建一个ActivityIdentificationResponse实例 |
| Return type | Method name |
| static ActivityIdentificationResponse | getDataFromIntent(Intent intent) |
| int | getActivityPossibility(int activityType) |
| long | getElapsedTimeFromReboot() |
| ActivityIdentificationData | getMostActivityIdentification() |
| List<ActivityIdentificationData> | getActivityIdentificationDatas() |
| long | getTime() |
| static boolean | containDataFromIntent(Intent intent) |
| constructor |
| public ActivityIdentificationResponse(List<ActivityIdentificationData> activityIdentificationDatas, long time, long elapsedTimeFromReboot) |
| 构建一个ActivityIdentificationResponse实例。 |
Parameters
| Parameter name | Parameter desc |
| activityIdentificationDatas | 检测到的周期内的所有活动列表,按置信度排序。 |
| time | 识别结果触发时,自1970年1月1日00:00:00以来的毫秒数。 |
| elapsedTimeFromReboot | 识别结果触发时,自设备启动以来的纳秒数。 |
| constructor |
| public ActivityIdentificationResponse(ActivityIdentificationData mostActivityIdentificationData, long time, long elapsedTimeFromReboot) |
| 构建一个ActivityIdentificationResponse实例。 |
Parameters
| Parameter name | Parameter desc |
| mostActivityIdentificationData | 检测到的周期内的最有可能的活动。 |
| time | 识别结果触发时,自1970年1月1日00:00:00以来的毫秒数。 |
| elapsedTimeFromReboot | 识别结果触发时,自设备启动以来的纳秒数。 |
| Method |
| public static ActivityIdentificationResponse getDataFromIntent(Intent intent) |
| 从活动识别服务发送的Intent的extras中获取ActivityIdentificationResponse。 |
Parameters
| Parameter name | Parameter desc |
| intent | 活动识别服务发送的Intent。 |
Return
| type | desc |
| ActivityIdentificationResponse | 如果intent不包含ActivityIdentificationResponse则返回null。 |
| Method |
| public int getActivityPossibility(int activityType) |
| 返回设置的活动类型的置信度。 |
Parameters
| Parameter name | Parameter desc |
| activityType | 活动类型。 |
Return
| type | desc |
| int | 置信度。 |
| Method |
| public long getElapsedTimeFromReboot() |
| 返回从设备启动以来到识别结果触发时的纳秒数,以纳秒为单位,使用SystemClock.elapsedRealtimeNanos()来获取。 |
Return
| type | desc |
| long | 时间戳,单位纳秒。 |
| Method |
| public ActivityIdentificationData getMostActivityIdentification() |
| 返回最接近用户行为的活动。 |
Return
| type | desc |
| ActivityIdentificationData | 检测最接近用户行为的活动。 |
| Method |
| public List<ActivityIdentificationData> getActivityIdentificationDatas() |
| 返回检测到的活动列表。这些活动是按照最有可能的活动排序的。 |
Return
| type | desc |
| List<ActivityIdentificationData> | 检测到的活动列表。 |
| Method |
| public long getTime() |
| 返回从1970年1月1日00:00:00到识别结果触发时的毫秒数,使用System.currentTimeMillis()来获取。 |
Return
| type | desc |
| long | 时间戳,单位毫秒。 |
| Method |
| public static boolean containDataFromIntent(Intent intent) |
| 如果Intent包含ActivityIdentificationResponse,则返回true。这是一个工具函数,可以从intent接收器内部调用,以确保接收到的intent来自活动识别。 |
Parameters
| Parameter name | Parameter desc |
| intent | 活动识别服务发送的Intent。 |
Return
| type | desc |
| boolean | 如果intent包含ActivityIdentificationResponse则返回true,intent为空或者intent中不包含ActivityIdentificationResponse则返回false。 |