Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Constants | Inherited Constants | Fields | Ctors | Methods | Inherited Methods | [Expand All]
public class

# DetectedActivity

extends Object
implements Parcelable

java.lang.Object
↳ | com.google.android.gms.location.DetectedActivity

## Class Overview

The detected activity of the device with an an associated confidence. See `ActivityRecognitionClient` for details on how to obtain a `DetectedActivity`.

## Summary

Constants
int | IN_VEHICLE | The device is in a vehicle, such as a car.
int | ON_BICYCLE | The device is on a bicycle.
int | ON_FOOT | The device is on a user who is walking or running.
int | STILL | The device is still (not moving).
int | TILTING | The device angle relative to gravity changed significantly.
int | UNKNOWN | Unable to detect the current activity.

[Expand] Inherited Constants

From interface android.os.Parcelable

int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final DetectedActivityCreator | CREATOR |

Public Constructors
| DetectedActivity(int activityType, int confidence) Constructs a DetectedActivity.

Public Methods
int | describeContents()
int | getConfidence() Returns a value from 0 to 100 indicating the likelihood that the user is performing this activity.
int | getType() Returns the type of activity that was detected.
String | toString()
void | writeToParcel(Parcel out, int flags)

[Expand] Inherited Methods

From class java.lang.Object

Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

From interface android.os.Parcelable

abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final int IN_VEHICLE

The device is in a vehicle, such as a car.

Constant Value: 0 (0x00000000)

#### public static final int ON_BICYCLE

The device is on a bicycle.

Constant Value: 1 (0x00000001)

#### public static final int ON_FOOT

The device is on a user who is walking or running.

Constant Value: 2 (0x00000002)

#### public static final int STILL

The device is still (not moving).

Constant Value: 3 (0x00000003)

#### public static final int TILTING

The device angle relative to gravity changed significantly. This often occurs when a device is picked up from a desk or a user who is sitting stands up.

Constant Value: 5 (0x00000005)

#### public static final int UNKNOWN

Unable to detect the current activity.

Constant Value: 4 (0x00000004)

## Fields

#### public static final DetectedActivityCreator CREATOR

## Public Constructors

#### public DetectedActivity (int activityType, int confidence)

Constructs a DetectedActivity.

##### Parameters

activityType | the activity that was detected.
confidence | value from 0 to 100 indicating how likely it is that the user is performing this activity.

## Public Methods

#### public int describeContents ()

#### public int getConfidence ()

Returns a value from 0 to 100 indicating the likelihood that the user is performing this activity.

The larger the value, the more consistent the data used to perform the classification is with the detected activity.

The sum of the confidences of all detected activities for a classification will be <= 100. This means that larger values such as a confidence of >= 75 indicate that it's very likely that the detected activity is correct, while a value of <= 50 indicates that there may be another activity that is just as or more likely.

#### public int getType ()

Returns the type of activity that was detected.

#### public String toString ()

#### public void writeToParcel (Parcel out, int flags)