Tag: 谷歌播放服务

GoogleApiClient:之后无法手动连接并执行signOut

我想手动处理GoogleApiClient上的connect()和disconnect()操作。 我试图: 建立一个新的GoogleApiClient (没有enableAutoManage ) 调用connect() 当onConnected()被调用时执行signOut 在signOut结束之后调用disconnect() 这是一个例子: fun signOut(googleApiClient: GoogleApiClient, resultCallback: (Status) -> Unit) { Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback(resultCallback) } fun test() { val googleApiClient = GoogleApiClient.Builder(activity) .addApi(Auth.GOOGLE_SIGN_IN_API, buildGoogleSignInOptions(googleAuthId)) .build() googleApiClient.registerConnectionCallbacks(object : ConnectionCallbacks { override fun onConnected(connectionHint: Bundle?) { signOut { status -> //TODO something with status googleApiClient.disconnect() } } override fun onConnectionSuspended(cause: Int) { //nop […]

Google Firebase在Android应用中注销并忘记用户

我面临着下一个问题: 当我打电话给mFirebaseAuth.signOut(); 或者mFirebaseUser.delete(); 我的FirebaseAuth.AuthStateListener()工作正常,并返回null作为onAuthStateChanged FirebaseUser实例,我刷新用户界面,并显示“用Google登录”按钮。 但是当我想再次登录时,我看不到用户的弹出窗口(我的设备上有两个用户,附加了图像)。 应用程序仅在首次登录时显示此弹出窗口,之后它将使用同一用户。 如果我在设置屏幕上清除应用程序的数据,我将能够再次看到这个弹出窗口。 我的问题是如何在每次退出后显示这个弹出窗口。 更新:我按下登录按钮时运行此代码: GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); startActivityForResult(signInIntent, FirebaseActivity.REQUEST_SIGN_IN); 在onActivityResult()我创建一个GoogleSignInResult的实例,所以我需要的一切发生后,我打电话startActivityForResult()

使用kapt时,Dagger跳过Google服务模块的工厂代码

我有一个Android应用程序,我已经转换到Kotlin,当涉及到一个特定的模块时,我遇到了Dagger的障碍。 在我的项目build.gradle ,我有: buildscript { ext.kotlin_version = "1.0.1-2" repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.0-alpha5' classpath 'com.google.gms:google-services:2.0.0-rc3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 而在app/build.gradle ,我有以下相关的设置: apply plugin: "nebula.dependency-lock" apply plugin: "com.android.application" apply plugin: 'kotlin-android' apply plugin: "kotlin-android-extensions" apply plugin: "com.getkeepsafe.dexcount" // … […]