user3551029
user3551029

Reputation: 75

How to resolve STATUS_OUT_OF_ORDER_API_CALL error?

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

                              }
                         });

Upvotes: 0

Views: 120

Answers (1)

Xlythe
Xlythe

Reputation: 2033

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.

Upvotes: 2

Related Questions