You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems not possible to identify an user with his login, for example to store game data in an external database?
There is the function "getPlayerDisplayName()" but the display name is not unique.
A function like "getPlayerID()" would be useful and should be easily to implement, for example for google: String getPlayerID() { return Games.Players.getCurrentPlayerId(mGoogleApiClient); }
for Apple Gamecenter: public String getPlayerID() { return isSessionActive() ? GKLocalPlayer.getLocalPlayer().gamePlayerID() : null; }
The text was updated successfully, but these errors were encountered:
I didn't have the need for this and the usefulness in practice is a bit limited because not all users on a platform will use a game service. So you'll need a fallback mechanism anyway, and if you have it, you can use that one in any case.
But if it is important for you, I am open and accepting PRs.
Edit: I missed the part of your comment where you already solved your issue :). Carry on 👍
One quick way around this is to extend the GpgsClient and directly access the Google Api Client:
public class CustomGpgsClient extends GpgsClient {
public GoogleApiClient getGoogleApiClient() {
return mGoogleApiClient;
}
}
Then elsewhere in your code (Mine below is in the listener) you can access the Player object manually via the google api client:
@Override
public void gsOnSessionActive() {
LOGGER.info("Player: {}",gamesClient.getPlayerDisplayName());
LOGGER.info("serviceid: {}",gamesClient.getGameServiceId());
//get google player object
Player gpgPlayer = Games.Players.getCurrentPlayer(gamesClient.getGoogleApiClient());
//access google specific props
LOGGER.info("details: {}",gpgPlayer.getPlayerId());
LOGGER.info("details: {}",gpgPlayer.getName());
LOGGER.info("details: {}",gpgPlayer.getBannerImageLandscapeUri());
LOGGER.info("details: {}",gpgPlayer.getBannerImagePortraitUri());
LOGGER.info("details: {}",gpgPlayer.getIconImageUri());
}
Obviously this is specific to the google api, so you'll have to handle skipping it if youre using multiple, or coming up with your own interface for it.
It seems not possible to identify an user with his login, for example to store game data in an external database?
There is the function "getPlayerDisplayName()" but the display name is not unique.
A function like "getPlayerID()" would be useful and should be easily to implement, for example for google:
String getPlayerID() { return Games.Players.getCurrentPlayerId(mGoogleApiClient); }
for Apple Gamecenter:
public String getPlayerID() { return isSessionActive() ? GKLocalPlayer.getLocalPlayer().gamePlayerID() : null; }
The text was updated successfully, but these errors were encountered: