我在游戏中实现了Google Play游戏服务。我可以连接它,但当我回到我的游戏时,我无法显示欢迎POPUP ...我怎么能显示它?
我尝试了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();
}
}
}
欢迎回来:
Games.getGamesClient(this,googleSignInAccount).setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
我实现了静音登录,在decorView上使用了setViewForPopups,欢迎回来只显示应用程序关闭了很长时间(约10小时工作,不确定更少)。弹出窗口每次显示交互式标志 - 在。