- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用 google 无提示登录,但由于某种原因未定义 GoogleSignInClient 类。当我按 alt-enter 时,它只是说“创建类”而不是导入类。感谢任何帮助,谢谢!
private void signInSilently() {
GoogleSignInClient signInClient = GoogleSignIn.getClient(this, GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
signInClient.silentSignIn().addOnCompleteListener(this,
new OnCompleteListener<GoogleSignInAccount>() {
@Override
public void onComplete(@NonNull Task<GoogleSignInAccount> task) {
if (task.isSuccessful()) {
// The signed in account is stored in the task's result.
GoogleSignInAccount signedInAccount = task.getResult();
} else {
// Player will need to sign-in explicitly using via UI
}
}
});
}
@Override
protected void onResume() {
super.onResume();
signInSilently();
}
另外:
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-identity:15.0.1'
最佳答案
我已经通过更新文件解决了问题
build.gradle (Project: projectname)
在这个特定部分
来自:
classpath 'com.google.gms:google-services:3.1.1'
与:
classpath 'com.google.gms:google-services:3.3.1'
关于java - 为什么我无法导入 GoogleSignInClient 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50772547/
我正在尝试使用 google 无提示登录,但由于某种原因未定义 GoogleSignInClient 类。当我按 alt-enter 时,它只是说“创建类”而不是导入类。感谢任何帮助,谢谢! priv
我正在尝试将我的游戏连接到 Google Play 游戏服务,但当我尝试登录时,它总是返回错误代码 8(内部错误)。 代码是从Google example:复制粘贴的 lateinit var sig
我无法使用 GoogleSignIn(com.google.android.gms.auth.api.signin.GoogleSignIn) 和 GoogleSignInClient(com.goo
我无法在实现 Google Sign 时使用 GoogleSignIn(com.google.android.gms.auth.api.signin.GoogleSignIn) 和 GoogleSig
1) 在我的HomeActivity 屏幕中会有一个用户注销按钮。此按钮导致 LoginActivity 的 signOut() 方法 @Override protected void onCrea
我需要将文本字符串与 Google 登录 Intent 一起传递,以便稍后在 onActivityResult 方法中检索它。 我使用以下代码触发 GSI 帐户选择器 Activity GoogleS
当我尝试在 Android 上静默登录时,我经常遇到以下错误。我该如何调试。这是什么原因。 (我的 Android 手机上有一个有效的 Google 帐户。) signInSilently(): fa
Google Play 服务版本 11.6.2 目标 Android SDK 27 我已通过引用 Google 在以下存储库中提供的 TypeANumber 项目实现了建议的新 GoogleSignI
除了为我的案例解决了问题(这已经是 super 膨胀了)我通常也对如何调试这种东西感兴趣(这不是我第一次遇到这种问题并且每次都解决它麻烦) 我的问题: 我希望我的用户能够在我的 Android 应用中
我是一名优秀的程序员,十分优秀!