目录

CLASS info
public class ActivityIdentificationResponse implements Parcelable, IMessageEntity
Activity identification result.

Field Summary

NameDesc
Creator<ActivityIdentificationResponse>CREATORDeserializes the activity identification result.

Public Constructor Summary

Constructor name
ActivityIdentificationResponse(List<ActivityIdentificationData> activityIdentificationDatas, long time, long elapsedTimeFromReboot) Builds a ActivityIdentificationResponse
ActivityIdentificationResponse(ActivityIdentificationData mostActivityIdentificationData, long time, long elapsedTimeFromReboot)  Builds a ActivityIdentificationResponse

Public Method Summary

Return typeMethod name
static ActivityIdentificationResponsegetDataFromIntent(Intent intent)
intgetActivityPossibility(int activityType)
longgetElapsedTimeFromReboot()
ActivityIdentificationDatagetMostActivityIdentification()
List<ActivityIdentificationData>getActivityIdentificationDatas()
longgetTime()
static booleancontainDataFromIntent(Intent intent)

Public Constructors

constructor
public ActivityIdentificationResponse (List<ActivityIdentificationData> activityIdentificationDatas, long time, long elapsedTimeFromReboot)
Builds a ActivityIdentificationResponse

Parameters

Parameter nameParameter desc
activityIdentificationDatasList of all activitiy identifications in the period. The activitiy identifications are sorted by confidence.
timeIdentification time. The value is the number of seconds elapsed since 00:00:00 of January 1, 1970.
elapsedTimeFromRebootIdentification time. Number of nanoseconds since boot.
constructor
public ActivityIdentificationResponse(ActivityIdentificationData mostActivityIdentificationData, long time, long elapsedTimeFromReboot)
Builds a ActivityIdentificationResponse

Parameters

Parameter nameParameter desc
mostActivityIdentificationDataMost possible activity identification in the period.
timeIdentification time. The value is the number of seconds elapsed since 00:00:00 of January 1, 1970.
elapsedTimeFromRebootIdentification time. Number of nanoseconds since boot.

Public Methods

Method
public static ActivityIdentificationResponse getDataFromIntent(Intent intent)
This API is used to obtain ActivityIdentificationResponse from extras of Intent sent by the activity Identification service.

Parameters

Parameter nameParameter desc
intentThe intent was sent from the activity identification service.

Return

typedesc
ActivityIdentificationResponseIf the Intent does not contain ActivityIdentificationResponse, null is returned.
Method
public int getActivityConfidence(int activityType)
This API is used to obtain the confidence of an activity type.

Parameters

Parameter nameParameter desc
activityTypeActivity type.

Return

typedesc
intConfidence
Method
public long getElapsedTimeFromReboot()

This API is used to obtain the elapsed real time (in milliseconds) of this detection since boot, including sleeping time obtained by SystemClock.elapsedRealtimeNanos().

Return

typedesc
long

timestamp, in nanoseconds.

Method
public ActivityIdentificationData getMostActivityIdentification()
This API is used to obtain the most probable activity identification of the user.

Return

typedesc
ActivityIdentificationDataActivity Identification.
Method
public List<ActivityIdentificationData> getActivityIdentificationDatas()
This API is used to obtain the list of activitiy identification list. The activity identifications are sorted by most probable activity first.

Return

typedesc
List<ActivityIdentificationData>activity identification  list.
Method
public long getTime()
This API is used to obtain the time of this identification, which is in milliseconds since January 1, 1970,obtained by System.currentTimeMillis().

Return

typedesc
longtimestamp, in milliseconds.
Method
public static boolean containDataFromIntent(Intent intent)
This API returns true if an Intent contains the ActivityIdentificationResponse object.This is a utility function that can be called inside an intent receiver to ensure that the received Intent is from activity identification.

Parameters

Parameter nameParameter desc
intentThe intent was sent from the activity identification service.

Return

typedesc
booleanIf the Intent contains ActivityIdentificationResponse, this parameter returns true. If the Intent is null or does not contain ActivityIdentificationResponse, this parameter returns false.