0

我在GamesClient为新的 Google Play 服务创建时遇到问题。我已经尝试过海报和在这里给出答案的人都没有成功。我已经关注了有关设置 Play 服务(更具体地说是排行榜)的所有文档,但我觉得他们的任何文档中都没有关于在何处以及如何设置GamesClient. 也许我错了,如果我错了,请给我链接。

现在我的代码中有以下代码,onCreate()但有错误。

GamesClient mGamesClient;
mGamesClient = new GamesClient(null, null, null, null, null, null, 0, null);
mGamesClient.connect();

//Error:  "The constructor GamesClient(Context, String, String, GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener, String[], int, View) is not visible.

我也试过这段代码没有成功:

GamesClient client = GamesClient.Builder(this, this, this).create();

//Error:  "The method Builder(MainMenu, MainMenu, MainMenu) is undefined for the type GamesClient."

有人可以为我提供如何实例化它的帮助GamesClient吗?

4

2 回答 2

4

您作为“this”MainMenu传递给GamesClient.Builder构造函数的类需要:

  • 做一个Context
  • 实施GooglePlayServicesClient.ConnectionCallbacks
  • 实施GooglePlayServicesClient.OnConnectionFailedListener

我猜这个类目前没有满足这些要求中的一个或多个。有关 GamesClient.Builder 的更多信息,请查看文档

于 2013-06-05T16:54:01.600 回答
0

我真的不认为上面的答案对你有帮助。我为您的问题苦苦挣扎了几个小时,现在我找到了解决方案。您以错误的方式执行 Builder,您必须创建它的一个对象(文档非常缺乏..)

mGamesClient = new GamesClient.Builder(getBaseContext(), this, this)
             .create();         
                mGamesClient.connect();

我希望它有帮助

于 2013-07-04T07:34:17.280 回答