Search code examples
androidgoogle-play-servicesactivity-recognition

ActivityRecognitionApi vs ActivityRecognitionClient issue


I have updated the google play services library to the latest version.

<integer name="google_play_services_version">6587000</integer>

I am working on the User Activity Recognition. Previous Google Play service library having the class ActivityRecognitionClient. After I have changed to the latest Google play service library I found the class ActivityRecognitionApi. But There is no connect or disconnect method available for the new class.

/**
 * Request a connection to Location Services. This call returns immediately,
 * but the request is not complete until onConnected() or
 * onConnectionFailure() is called.
 */
private void requestConnection() {
    getActivityRecognitionClient().connect();
}

getActivityRecognitionClient() method is unavailable in new Google Play service library. If i use the instance of ActivityRecognitionApi class, it dont have the connect or disconnect method.

In the Android developer site also they have not updated the given tutorial to newly introduced api called ActivityRecognitionApi.

Please help me on this. Thanks in advance.


Solution

  • I had a similar issue. This blog post will help you.

    Now you have to use GoogleApiClient for user Activity Updates.