问题
How to implement Google Login in Phonegap App & also how to check whether the user is logged in or not as soon as the user opens up the app ? I am already aware of the EddyVerbruggen Plugin but it doesn't tells the status of login, it just logs in the user and also its trysilentLogin method doesn't works (yields error : 4) . Without knowing the login status how can I direct my users to the welcome page of my app.
HTML :
<body onload="init()">
</body>
config.xml :
<plugin name="cordova-plugin-googleplus" source="npm" spec="5.2.1">
</plugin>
login.js :
function init()
{
document.addEventListener("deviceready", onDeviceReady, false);
}
var onDeviceReady = function()
{
window.plugins.googleplus.trySilentLogin(
{
'scopes': '',
'offline': false
},
function (obj) {
alert(JSON.stringify(obj)); // do something useful instead of alerting
alert(' YES LOGGED IN ::: GOOGLE ');
},
function (msg) {
alert(' GOOGLE LOGIN error: ' + msg); //here comes the error : 4
}
);
来源:https://stackoverflow.com/questions/49732360/how-to-add-functionality-of-google-sign-in-in-phonegap-hybrid-html-app