androidgoogle-play-servicesgoogle-nearby-connections

Nearby Connections discovery throws error 8036 on Android10


When calling ConnectionsClient#startDiscovery(String, EndpointDiscoveryCallback, DiscoveryOptions) on my OnePlus7Pro (Android 10), I get

    com.google.android.gms.common.api.ApiException: 8036: unknown status code: 8036
        at com.google.android.gms.internal.nearby.zzby.setFailedResult(Unknown Source:4)
        at com.google.android.gms.internal.nearby.zzba.zzc(Unknown Source:18)
        at com.google.android.gms.internal.nearby.zzea.dispatchTransaction(Unknown Source:7)
        at com.google.android.gms.internal.nearby.zzb.onTransact(Unknown Source:22)
        at android.os.Binder.execTransactInternal(Binder.java:1032)
        at android.os.Binder.execTransact(Binder.java:1005)

I don't think this is a problem of my code. The code works fine for any other Android version. The same thing happens on the official sample https://github.com/android/connectivity-samples/tree/master/NearbyConnectionsRockPaperScissors and can be reproduced there by adding a failure listener.

The error is not defined in the docs https://developers.google.com/android/reference/com/google/android/gms/nearby/connection/ConnectionsStatusCodes. Advertising works fine.

Any idea what the error means and how to get rid of it?


Solution

  • This status code means that the ACCESS_FINE_LOCATION permission was not requested at runtime, but this permission is now required by Android 10 in order to discover.

    See https://developers.google.com/nearby/connections/android/get-started to verify you have all the necessary permissions.

    Our status code docs are out of date, so we will update https://developers.google.com/android/reference/com/google/android/gms/nearby/connection/ConnectionsStatusCodes to make sure all the status codes are included shortly.