【发布时间】:2014-06-08 07:12:32
【问题描述】:
我正在尝试在我的游戏中实现排行榜。 我写了这段代码:
GoogleApiClient mGoogleApiClient;
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.build();
mGoogleApiClient.connect();
//....
while(!mGoogleApiClient.isConnected())Log.d("","NO CONNECTED");
Games.Leaderboards.submitScore(mGoogleApiClient, "MY_LEADERBOARD_ID",newscore);
为什么mGoogleApiClient.isConnected()总是返回假?
EDIT1:好的,现在它可以工作了(我已将 Drive.API 更改为 Games.API 和 Drive.SCOPE_FILE 更改为 Games.SCOPE_GAME)但是当我调用 submitScore() 时,即使日志中一切正常,排行榜仍然存在空的。如何检查submitScore() 是否真的有效?
EDIT2:我用过
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, "MY_LEADERBOARD_ID"), REQ_LEADERBOARD);
一切正常!
【问题讨论】:
标签: android google-play-services google-play-games