【发布时间】:2018-05-05 08:57:26
【问题描述】:
我在我的游戏中实现了 google play 游戏服务。我可以连接它,但是当我回到我的游戏时,我无法显示欢迎弹出窗口...我该如何显示它?
我尝试了 setViewForPopups 和 setGravityForPopups 就像他们在文档中所说的那样......
private void startSignInIntent() {
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.requestEmail()
.build();
GoogleSignInClient signInClient = GoogleSignIn.getClient(getActivity(),
gso);
Intent intent = signInClient.getSignInIntent();
startActivityForResult(intent, RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
// The signed in account is stored in the result.
GoogleSignInAccount signedInAccount = result.getSignInAccount();
Games.getGamesClient(getContext(), signedInAccount).setViewForPopups(getView());
} else {
String message = result.getStatus().getStatusMessage();
if (message == null || message.isEmpty()) {
message = getString(R.string.signin_other_error);
}
new AlertDialog.Builder(getActivity()).setMessage(message)
.setNeutralButton(android.R.string.ok, null).show();
}
}
}
【问题讨论】:
-
你遇到了什么错误?
-
我没有错误但我没有弹出窗口...我不知道如何显示欢迎弹出窗口...
-
你有没有解决过这个问题,遇到同样的问题
标签: android google-play-services google-play-games