Malith
Malith

Reputation: 401

Is ActivityRecognitionApi or ActivityRecognitionClient deprecated?

In the Google APIs guide, it says ActivityRecognitionApi is deprecated. [15 Oct 2017]
enter image description here

So, I tried to use ActivityRecognitionClient. When building the project following error jumps.

cannot find symbol import com.google.android.gms.location.ActivityRecognitionClient;

But in the docs, it's supposed to be there.

I'm using com.google.android.gms:play-services-location:11.0.4 Found out that Google have released 11.4.0 also. But my SDK manager gets only 11.0.4 as the newest version. (updating to Google repository rev 58)

So, what's wrong here? is API docs are not updated? or error with SDK manager? or something else?

Upvotes: 1

Views: 3982

Answers (1)

Kuba Spatny
Kuba Spatny

Reputation: 26978

The ActivityRecognitionApi is really deprecated. Since version 11.4.0, the ActivityRecognitionClient is to be used.

Example Use:

ActivityRecognitionClient activityRecognitionClient = ActivityRecognition.getClient(context);
Task task = activityRecognitionClient.requestActivityUpdates(1000, pendingIntent);

For more info see the docs or sample android app.

Upvotes: 1

Related Questions