目录

ActivityConversionData

Class Info

public class ActivityConversionData implements Parcelable

Activity conversion event. You can obtain a list of conversion events using getActivityConversionDatas() of the ActivityConversionResponse class.

The following sample code obtains an ActivityConversionData object:
Java
ActivityIdentificationResponse activityRecognitionResult =
    ActivityIdentificationResponse.getDataFromIntent(intent);
if (activityRecognitionResult != null) {
    List<ActivityIdentificationData> list = activityRecognitionResult.getActivityIdentificationDatas();
}
Kotlin
val activityRecognitionResult =
    ActivityIdentificationResponse.getDataFromIntent(intent)
if (activityRecognitionResult != null) {
    val list =
        activityRecognitionResult.activityIdentificationDatas
}

Public Field Summary

Qualifier and Type

Field and Description

static final Creator<ActivityConversionData>

CREATOR

Default builder for deserializing the activity conversion event.

Public Constructor Summary

Constructor Name

ActivityConversionData()

Builds an ActivityConversionData instance.

ActivityConversionData(int activityType, int conversionType, long elapsedTimeFromReboot)

Builds an ActivityConversionData instance.

Public Method Summary

Qualifier and Type

Method Name and Description

int

getActivityType()

Obtains the conversion activity type.

int

getConversionType()

Obtains the conversion type.

long

getElapsedTimeFromReboot()

Obtains the number of nanoseconds elapsed since the device boot time to the activity conversion time.

Public Fields

[h2]CREATOR

Fields

public static final Creator<ActivityConversionData> CREATOR

Default builder for deserializing the activity conversion event.

Public Constructors

[h2]ActivityConversionData

Constructor

public ActivityConversionData()

Builds an ActivityConversionData instance.

[h2]ActivityConversionData(int activityType, int conversionType , long elapsedTimeFromReboot)

Constructor

public ActivityConversionData(int activityType, int conversionType , long elapsedTimeFromReboot)

Builds an ActivityConversionData instance by specified parameters. The value of the activityType parameter must be one of the activity types defined by ActivityIdentificationData, and the value of the conversionType parameter must be one of the conversion types defined by ActivityConversionInfo. Otherwise, an error indicating invalid parameter will be thrown.

Parameters

Name

Description

activityType

Activity type. For details, please refer to Constant Values.

conversionType

Conversion type. For details, please refer to Constant Values.

elapsedTimeFromReboot

Number of nanoseconds elapsed since the device boot time to the activity conversion time.

Throws

Name

Description

IllegalArgumentException

Invalid parameter. Ensure that the values of activityType and conversionType are valid.

Public Methods

[h2]getActivityType

Method

public int getActivityType()

Obtains the conversion activity type. The value is one of the activity types defined in ActivityIdentificationData. Activity type OTHERS is not supported.

Returns

Type

Description

int

Activity type. The activity type cannot be OTHERS. For details, please refer to Constant Values.

[h2]getConversionType

Method

public int getConversionType()

Obtains the conversion type. The value is one of the conversion types defined in ActivityConversionInfo.

Returns

Type

Description

int

Conversion type. For details, please refer to Constant Values.

[h2]getElapsedTimeFromReboot

Method

public long getElapsedTimeFromReboot()

Obtains the number of nanoseconds elapsed since the device boot time to the activity conversion time using SystemClock.elapsedRealtimeNanos().

Returns

Type

Description

long

Timestamp, in nanoseconds.