本文整理汇总了Java中com.google.android.gms.nearby.connection.ConnectionsStatusCodes.STATUS_OK属性的典型用法代码示例。如果您正苦于以下问题:Java ConnectionsStatusCodes.STATUS_OK属性的具体用法?Java ConnectionsStatusCodes.STATUS_OK怎么用?Java ConnectionsStatusCodes.STATUS_OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.gms.nearby.connection.ConnectionsStatusCodes
的用法示例。
在下文中一共展示了ConnectionsStatusCodes.STATUS_OK属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnectionResult
@Override
public void onConnectionResult(String endpointId, ConnectionResolution result) {
switch (result.getStatus().getStatusCode()) {
case ConnectionsStatusCodes.STATUS_OK:
// We're connected! Can now start sending and receiving data.
stopDiscovering();
ConnectedEndPointId = endpointId;
logthis("Status ok, sending Hi message");
send("Hi from Discovery");
break;
case ConnectionsStatusCodes.STATUS_CONNECTION_REJECTED:
logthis("Status rejected. :(");
// The connection was rejected by one or both sides.
break;
case ConnectionsStatusCodes.STATUS_ERROR:
logthis("Status error.");
// The connection broke before it was able to be accepted.
break;
}
}
示例2: onConnectionResult
@Override
public void onConnectionResult(String endpointId, ConnectionResolution result) {
logthis("Connection accept :" + endpointId + " result is " + result.toString());
switch (result.getStatus().getStatusCode()) {
case ConnectionsStatusCodes.STATUS_OK:
// We're connected! Can now start sending and receiving data.
ConnectedEndPointId = endpointId;
//if we don't then more can be added to conversation, when an List<string> of endpointIds to send to, instead a string.
// ... .add(endpointId);
stopAdvertising(); //and comment this out to allow more then one connection.
logthis("Status ok, sending Hi message");
send("Hi from Advertiser");
break;
case ConnectionsStatusCodes.STATUS_CONNECTION_REJECTED:
logthis("Status rejected. :(");
// The connection was rejected by one or both sides.
break;
case ConnectionsStatusCodes.STATUS_ERROR:
logthis("Status error.");
// The connection broke before it was able to be accepted.
break;
}
}
示例3: onConnectionResponse
@Override
public final void onConnectionResponse(String remoteEndpointId, Status status, byte[] bytes) {
switch (status.getStatusCode()) {
case ConnectionsStatusCodes.STATUS_OK:
onNearbyConnectionEndpointConnected(remoteEndpointId);
break;
case ConnectionsStatusCodes.STATUS_CONNECTION_REJECTED:
break;
case ConnectionsStatusCodes.STATUS_NOT_CONNECTED_TO_ENDPOINT:
break;
}
}