rekire rekire - 4 months ago 30
Android Question

Which dependency is required for Awareness API?

I want to check out the new Awareness API which is quite new. I’m using Play Services 9.0.2. The documentation has this example:

GoogleApiClient client = new GoogleApiClient.Builder(context)
.addApi(Awareness.API)
.build();
client.connect();


However, there is no hint which dependency needs to been added. Any idea?

Answer

I found it out: I need to upgrade to PlayServices 9.2.0 and the dependency is hidden in play-services-contextmanager. Just add those dependencies and here we go:

compile 'com.google.android.gms:play-services-basement:9.2.0'
compile 'com.google.android.gms:play-services-contextmanager:9.2.0'

Please use the latest play services library, at the time I wrote this answer it was 9.2.0

Keep in mind that this library was added in the Play Services Repository v31. Make sure that you have at least that version installed in the SDK manager.

Comments