android - How To Create Leaderboard For An Firebase Anonymous User? -


i creating android game has leaderboard show user scores name, profile pic , score list item.

later decided remove google login implemented game in order increase user flow game play page. @ same time wanted have users authenticated (for security) without asking them click on login button (where many drop off happening). found anonymous authentication option in firebase authentication section.

my question when relay on anonymous login throughout game need have convert anonymous user google user programmatically show them in leaderboard list or google handles automatically/internally?

current working flow

step 1: connect google client api (see below written code)

step 2: authenticate firebase (google sign in method)

step 3: show leaderboard

current implementation

when open leaderboard activity have following code show leadeboard (here user authenticated google signin method),

googlesigninoptions gso = new  googlesigninoptions.builder(googlesigninoptions.default_sign_in)             .requestidtoken(getstring(r.string.default_web_client_id))             .build();      // [end config_signin] mgoogleapiclient = new googleapiclient.builder(this)             .addonconnectionfailedlistener(this)             .addconnectioncallbacks(this)             .addapi(auth.google_sign_in_api, gso)             .addapi(games.api).addscope(games.scope_games)             .build(); ... ... ...  @override public void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);      googlesigninresult result =      auth.googlesigninapi.getsigninresultfromintent(data);      if (result.issuccess()) {         // sign in successful, authenticate firebase       googlesigninaccount account = result.getsigninaccount();       firebaseauthwithgoogle(account);     } } ... ... ...  //on button click....... public void submitscore(long score) {     if (isgoogleapiconnected()) {       games.leaderboards.submitscore(mgoogleapiclient, getstring(r.string.my_leaderboard), score);    } } 

the above written code working google authentication method. can use same above code when use anonymous authentication method also?

reference:: authenticate using google sign-in on android

the leaderboard has no connection firebase account, thing have make sure have google api connected game api scope. leaderboard show based on connected google account irrespective of using anonymous or linked firebase account.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -