在我的 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/