我想在我的应用程序中显示等待活动...我在3:15分钟在谷歌i / o视频(http://www.youtube.com/watch?v=duIV7mYZP6s)中看到它在三个屏幕的中心..谁可以提供帮助我吗?
感谢约翰
答案 0 :(得分:0)
这是通过启动结果活动在API中提供的,并在此处解释Google Play Game Services
向下滚动到区域标题“可选:添加等候室UI”
启动内置等候室UI,使用GamesClient.getRealTimeWaitingRoomIntent()返回的Intent。
您可以在RoomUpdateListener.onRoomConnected和RoomUpdateListener.onJoinedRoom回调中启动候诊室用户界面。
// arbitrary request code for the waiting room UI.
// This can be any integer that's unique in your Activity.
final static int RC_WAITING_ROOM = 10002;
@Override
public void onJoinedRoom(int statusCode, Room room)
{
if (statusCode != GamesClient.STATUS_OK)
{
// display error
return;
}
// get waiting room intent
Intent i = getGamesClient().getRealTimeWaitingRoomIntent(room, Integer.MAX_VALUE);
startActivityForResult(i, RC_WAITING_ROOM);
}
@Override
public void onRoomCreated(int statusCode, Room room)
{
if (statusCode != GamesClient.STATUS_OK)
{
// display error
return;
}
// get waiting room intent
Intent i = getGamesClient().getRealTimeWaitingRoomIntent(room, Integer.MAX_VALUE);
startActivityForResult(i, RC_WAITING_ROOM);
}
答案 1 :(得分:0)
在onRoomCreated
和onRoomJoined
时显示默认候诊室,并在onRoomConnected
private void showWaitingRoom(Room room) {
final int MIN_PLAYERS = 1;
Intent i = getGamesClient().getRealTimeWaitingRoomIntent(room, MIN_PLAYERS);
startActivityForResult(i, RC_WAITING_ROOM);
}
private void dismissWaitingRoom() {
finishActivity(RC_WAITING_ROOM);
}