android - 登录成功后 cordova-plugin-googleplus 插件无回调

标签 android cordova cordova-plugins google-plus-signin

在我的 ionic 应用程序中使用 cordova-plugin-googleplus 的 Google plus 登录出现问题。登录后,不调用成功回调。

      window.plugins.googleplus.login(
        {
            'scopes': 'email profile', 
            'webClientId': '**********', 
            'offline': true, 
        },
        function (obj) {
            alert('login success');
            //... user service called

        },
        function (msg) {
            alert('error: ' + msg);
        }
    );

在上面的代码 fragment 中,两个警报都没有被调用。当我检查 adb logcat 日志时,我发现登录成功:

    D/CordovaActivity( 1614): Incoming Result. Request code = 77552
    D/CordovaInterfaceImpl( 1614): Sending activity result to plugin
    I/GooglePlugin( 1614): In onActivityResult
    I/GooglePlugin( 1614): One of our activities finished up
    I/GooglePlugin( 1614): Handling SignIn Result
    I/GooglePlugin( 1614): trying to get account information
    W/CordovaPlugin( 1614): Attempted to send a second callback for 
    ID: *************
    W/CordovaPlugin( 1614): Result was: {**** correct user info ****}

同样有趣的是,window.plugins.googleplus.trySilentLogin 工作正常。 我使用的是 android 物理设备,还有 facebook 插件等等。

任何解决这个问题的建议都会很棒。

最佳答案

我在用这个插件,刚刚删除

'webClientId': '**********',
'offline': true,

所以插件可以正常工作。

关于android - 登录成功后 cordova-plugin-googleplus 插件无回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43837967/

相关文章:

android - Cordova 应用程序图片和布局在某些设备中拉伸(stretch),特别是 Samsung galaxy S4

ios - 找不到模块 'simple-plist'

android - Cordova 插件回调使用什么线程?

android - 在 ionic 中生成适用于 API 级别 19 的 Apk

ionic-framework - 添加到构造函数后,Ionic 4 cordova-plugin-ftp 出现问题

android - 通过 intent extras 发送大数据时出现 TransactionTooLargeException

android - 在 Android 中以编程方式在当前相对布局下方添加相对布局

android - 为同一类的不同版本构建 flavor

android - GRPC OkHttp版本(1.29.0)如何升级com.squareup.okhttp(4.6.0)?

ios - Ionic - 在 Apple Maps App 中打开导航方向