问题
I am trying to create a Nearby app. I am trying to connect two devices. I found a device an endpoint and then I send a connection request with requestConnection method of Nearby API. In failure listener of this API I am getting "STATUS_OUT_OF_ORDER_API_CALL" in error message. What can be the possible reasons for this error, and how to handle it.
Nearby.getConnectionsClient(context)
.requestConnection(myEndPointName, endPointID,
discoverConnectionLifecycleCallback)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "start connection onSuccess");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.e(TAG, "start connection onFailure " + e.getLocalizedMessage());
// here I am getting STATUS_OUT_OF_ORDER_API_CALL in error message
}
});
回答1:
POINT_TO_POINT only allows one connection at a time (either incoming or outgoing, not both). OUT_OF_ORDER is given if you try to connect to someone else without first disconnecting from the existing connection.
来源:https://stackoverflow.com/questions/54037972/how-to-resolve-status-out-of-order-api-call-error