I'm testing Nearby connection API with the sample application available here: https://github.com/googlesamples/android-nearby It seems that this is not working for some devices. I successfully connected Samsung Galaxy S3 with Nexus 7, in both directions (S3 as host, N7 as slave and vice versa). However, when I try to connect Samusung Galaxy S3 to Nexus 5, the connection ALWAYS fails, with status code 8005.
Below you can see the method invoked by slave (discovering device) in order to connect to host (advertising device).
private void connectTo(String endpointId, final String endpointName) {
debugLog("connectTo:" + endpointId + ":" + endpointName);
// Send a connection request to a remote endpoint. By passing 'null' for the name,
// the Nearby Connections API will construct a default name based on device model
// such as 'LGE Nexus 5'.
String myName = null;
byte[] myPayload = null;
Nearby.Connections.sendConnectionRequest(mGoogleApiClient, myName, endpointId, myPayload,
new Connections.ConnectionResponseCallback() {
@Override
public void onConnectionResponse(String endpointId, Status status,
byte[] bytes) {
Log.d(TAG, "onConnectionResponse:" + endpointId + ":" + status);
if (status.isSuccess()) {
debugLog("onConnectionResponse: " + endpointName + " SUCCESS");
Toast.makeText(MainActivity.this, "Connected to " + endpointName,
Toast.LENGTH_SHORT).show();
mOtherEndpointId = endpointId;
updateViewVisibility(STATE_CONNECTED);
} else {
debugLog("onConnectionResponse: " + endpointName + " FAILURE. ResponseCode=" + status.getStatusCode() + " statusMessage=" + status.getStatusMessage() );
}
}
}, this);
}
The result I always get is :
11-17 18:48:50.678 11133-11133/com.google.example.connectionsquickstart D/MainActivity: onConnectionResponse: Samsung GT-I9300 FAILURE. ResponseCode=8005 statusMessage=null
Any clue what is going on?