How to resolve STATUS_OUT_OF_ORDER_API_CALL error?

拜拜、爱过 提交于 2020-01-06 07:45:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!