当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionsStatusCodes.STATUS_OK属性代码示例

本文整理汇总了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;
    }
}
 
开发者ID:JimSeker,项目名称:googleplayAPI,代码行数:20,代码来源:DiscoveryFragment.java

示例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;
    }
}
 
开发者ID:JimSeker,项目名称:googleplayAPI,代码行数:24,代码来源:AdvertiseFragment.java

示例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;
    }
}
 
开发者ID:asadmshah,项目名称:drawnearby,代码行数:12,代码来源:BaseConnection.java


注:本文中的com.google.android.gms.nearby.connection.ConnectionsStatusCodes.STATUS_OK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。