谷歌在创建房间成功,但错误发挥服务,签署 [英] Google play services, sign in succeeded but error on create room

查看:345
本文介绍了谷歌在创建房间成功,但错误发挥服务,签署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是非常类似的问题别人这里对不同之处在于该固定他们的解决方案是不我的问题。 (注:我使用libgdx开发这个,但我pretty确保无关这个问题,因为签署部分工作)

This is very similar to a problem someone else had on here except that the solution that fixed theirs is not my problem. (Note: I am using libgdx to develop this but I'm pretty sure that has nothing to do with this issue since the signing part is working)

@Override
public void startQuickGame() {
    boolean signedIn = getSignedIn();
    System.out.println(signedIn);
     // automatch criteria to invite 1 random automatch opponent.  
    // You can also specify more opponents (up to 3). 
    Bundle am = RoomConfig.createAutoMatchCriteria(1, 4, 0);

    // build the room config:
    RoomConfig.Builder roomConfigBuilder = makeBasicRoomConfigBuilder();
    roomConfigBuilder.setAutoMatchCriteria(am);
    RoomConfig roomConfig = roomConfigBuilder.build();

    // create room:
    aHelper.getGamesClient().createRoom(roomConfig);
}

和这里是我检查时,房间被创建。

And here is where I check when the room is created.

final static int RC_WAITING_ROOM = 10002;
@Override
public void onRoomCreated(int statusCode, Room room) {
    if (statusCode != GamesClient.STATUS_OK) {
        System.out.println(statusCode);
        return;
    }
    // get waiting room intent
    Intent i = aHelper.getGamesClient().getRealTimeWaitingRoomIntent(room, Integer.MAX_VALUE);
    startActivityForResult(i, RC_WAITING_ROOM);
}

状态code我越来越有6对应

The status code I'm getting there is 6 which corresponds to

STATUS_NETWORK_ERROR_OPERATION_FAILED

我绝对签署之前创建房signedIn始终为true。

I'm definitely signed in before it creates the room as signedIn is always true.

我的包名匹配,而我甚至看到了这个在我的API控制台。

My package name is matching, and I'm even seeing this in my api console.

推荐答案

想通了。误导性的Javadoc再加上人为的错误。

Figured it out. Misleading Javadoc plus human error.

我把那第二个参数指的是最大的玩家数量,而不是玩家邀请最大数量,因此你+ 3等。

I took that second argument to mean the max number of players, not the max number of players to invite, hence you + 3 others.

因此​​,这里是我的code = P的元凶

So here is the culprit in my code =p

Bundle am = RoomConfig.createAutoMatchCriteria(1, 4, 0);

Bundle am = RoomConfig.createAutoMatchCriteria(1, 3, 0);

而现在它工作得很好=)

And now it works just fine =)

这篇关于谷歌在创建房间成功,但错误发挥服务,签署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆