Reputation: 1384
I am trying to use android nearby connection api in android things. But i am getting this error com.google.android.gms.common.api.ApiException: 17: API: Nearby.CONNECTIONS_API is not available on this device. while advertising from android things.
Here is my gradle file of android things app:
compileOnly 'com.google.android.things:androidthings:1.0'
implementation 'com.google.android.gms:play-services-nearby:16.0.0'
I am using latest version of android things in raspberry pi. And here is my menifest file:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:label="@string/app_name">
<uses-library android:name="com.google.android.things" />
<activity android:name=".HomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
Why i am getting this error? Thanks in advance.
Upvotes: 0
Views: 315
Reputation: 3996
If it helps, I got it working with:
api 'com.google.android.gms:play-services-nearby:15.0.1'
You can check the source code from the project here: https://github.com/plattysoft/Beret
Upvotes: 1
Reputation: 2565
A few potential error sources here:
implementation 'com.google.android.gms:play-services-nearby:16.0.0'
Play Services on Android Things isn't updated over-the-air, so the library you're using should match the bundled version, which should be 12.5.20.
Your issue sounds similar to this one. Are you using the API the same way as described in the issue?
Upvotes: 0