java - How can I set up Google Play game sign in? -


i looked @ documentation , searched online tutorials, saw using basegameactivity.java , others not , i've never been more confused, i'll list questions hoping clear things me (please don't respond documentation link only).

all need player automatically signs in @ start.

1) game have published or have insert id-s somewhere?(my game on developer console ready published).

2) actual code have write sign in function?

follow steps google play games services docs has specified you.

step 1. sign in google play developer console

step 2. add game google play developer console

step 3. generate oauth 2.0 client id

check gpgs android samples in github well.

what actual code have write sign in function?

how implement sign-in in android game

private static int rc_sign_in = 9001; private boolean mresolvingconnectionfailure = false; private boolean mautostartsigninflow = true; private boolean msigninclicked = false;  // ...  @override public void onconnectionfailed(connectionresult connectionresult) {     if (mresolvingconnectionfailure) {         // resolving         return;     }      // if sign in button clicked or if auto sign-in enabled,     // launch sign-in flow     if (msigninclicked || mautostartsigninflow) {         mautostartsigninflow = false;         msigninclicked = false;         mresolvingconnectionfailure = true;          // attempt resolve connection failure using basegameutils.         // r.string.signin_other_error value should reference generic         // error string in strings.xml file, such "there         // issue sign in, please try again later."         if (!basegameutils.resolveconnectionfailure(this,                 mgoogleapiclient, connectionresult,                 rc_sign_in, r.string.signin_other_error)) {             mresolvingconnectionfailure = false;         }     }      // put code here display sign-in button } 

Comments