Google Play Games stay logged in?


#1

I’m trying to keep the user logged into Google Play services after the apps been closed down so it doesn’t have to log in every time the app starts. How do I keep it in?


#2

hi zebb!

i implemented Goggle play 2 weeks ago and did not have any trouble. If you logged in first the and “allow” the profile access just do the login again when your App is loading.

For me it works great like this:

function GoogleLogin() {
socialService.login(function(loggedIn, error) {
if (error) {
console.error("login error: " + error.message);
}
else if (loggedIn) {
console.log(“login succeeded”);
googlelogindone = true;
}
else {
console.log(“login cancelled”);
}
});

}

In my Menu load:

if (googlelogindone == false){
GoogleLogin();
}

Also see Cocoon.io Documentation:
http://docs.cocoon.io/article/cocoon-google-play-games-social-plugin/

Hope it helps :slightly_smiling:

Simon


#3

Hello everyone, Hope everyone is doing fine. This login issue seems to be different for every one. in my case on the main menu layout I gave these conditions please check the image below.

each and everytime I go to this main menu layout, it logs in. it dosent matter how many times i go to that layout, it logs in.
Would You please help me @andy_reitberger ? my game is already out in the Playstore and this one this is so buggy. Help me with this please.
Thank You.